Part Number Hot Search : 
CY2291FI 001547 2SA10 HZS11A3 AOP605L SY10E SPX29303 MP3V5050
Product Description
Full Text Search
 

To Download MC68HC908PT48CFU Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  order this document by mc68hc08pt48/d rev. 2.0 non-disclosure agreement required 68hc08pt48 68hc908pt48 advance information this document contains information on a new product. specifications and information herein are subject to change without notice. hc08 hc08 hc08
non-disclosure agreement required advance information advance information mc68hc(9)08pt48 rev. 2.0 2 motorola motorola reserves the right to make changes without further notice to any products herein to improve reliability, function or design. motorola does not assume any liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part.
mc68hc(9)08pt48 rev. 2.0 advance information motorola list of sections 3 non-disclosure agreement required advance information mc68hc(9)08pt48 list of sections section 1. general description . . . . . . . . . . . . . . . . . . . 27 section 2. memory map . . . . . . . . . . . . . . . . . . . . . . . . . 37 section 3. central processing unit (cpu). . . . . . . . . . . . 53 section 4. clock generator module (cgmb) . . . . . . . . 69 section 5. computer operating properly (cop) module . . . . . . . . . . . . . . . . . . . 103 section 6. keyboard interrupt (kbi) module . . . . . . . . 109 section 7. system integration module (sim) . . . . . . . . 117 section 8. random-access memory (ram) . . . . . . . . 141 section 9. 2-kbyte flash memory. . . . . . . . . . . . . . . . 143 section 10. 48-kbyte flash memory. . . . . . . . . . . . . . 153 section 11. serial peripheral interface (spi) module . . . . . . . . . . . . . . . . . . . . 165 section 12. serial communications interface (sci) module. . . . . . . . . . . . . . . . . . . . 197 section 13. analog-to-digital converter (adc) module. . . . . . . . . . . . . . . . . . 233 section 14. configuration register (config) . . . . . . . 243 section 15. timer interface module (tim) . . . . . . . . . . 247
non-disclosure agreement required list of sections advance information mc68hc(9)08pt48 rev. 2.0 4 list of sections motorola section 16. timebase module (timtbx). . . . . . . . . . . . 275 section 17. input/output (i/o) ports . . . . . . . . . . . . . . 281 section 18. monitor rom (mon) . . . . . . . . . . . . . . . . . 299 section 19. break module. . . . . . . . . . . . . . . . . . . . . . . 309 section 20. external interrupt module (irq) . . . . . . . . 315 section 21. alert output generator (alr) . . . . . . . . . . 325 section 22. electrical specifications . . . . . . . . . . . . . . 331 section 23. mechanical data. . . . . . . . . . . . . . . . . . . . 345 section 24. ordering information . . . . . . . . . . . . . . . . . 347
mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 5 non-disclosure agreement required advance information mc68hc(9)08pt48 table of contents section 1. general description 1.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.6 pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.6.1 power supply pins (v dd , v ss , ev dd1-4 , ev ss1-4 ,v dda1,2 ,v ssa1,2 ). . . . . . . . . . . . . . . . . . . . . . . .32 1.6.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . .33 1.6.3 external reset pin ( rst) . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.6.4 external interrupt pin ( irq1). . . . . . . . . . . . . . . . . . . . . . . .34 1.6.5 external interrupt pin ( irq2). . . . . . . . . . . . . . . . . . . . . . . .34 1.6.6 external filter capacitor pins (pllxfc). . . . . . . . . . . . . . .34 1.6.7 port a i/o pins (pta7Cpta0) . . . . . . . . . . . . . . . . . . . . . . .34 1.6.8 port b i/o pins (ptb7Cptb0) . . . . . . . . . . . . . . . . . . . . . . .34 1.6.9 port c i/o pins (ptc7Cptc0). . . . . . . . . . . . . . . . . . . . . . .34 1.6.10 port d i/o pins (ptd7Cptd0). . . . . . . . . . . . . . . . . . . . . . .34 1.6.11 port e i/o pins (pte7/ad3Cpte4/ad0 and pte3/miso-pte0/ss) . . . . . . . . . . . . . . . . . . . . . .35 1.6.12 port f i/o pins (ptf7/kbd7Cptf0/kbd0) . . . . . . . . . . . . .35 1.6.13 port g i/o pins (ptg7/tch3Cptg3/tclk, ptg2/txd, ptg1/rxd, and ptg0) . . . . . . . . . . . . . . . . . . . . . . . . .35 1.6.14 alert generator output (alert) . . . . . . . . . . . . . . . . . . . . .35 1.6.15 adc voltage reference pin (v rh ) . . . . . . . . . . . . . . . . . . .35
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 6 table of contents motorola section 2. memory map 2.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 2.3 i/o section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 2.4 random-access memory (ram) . . . . . . . . . . . . . . . . . . . . . . .38 2.5 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 2.6 user flash/rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 2.7 flash prom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 2.8 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 section 3. central processing unit (cpu) 3.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 3.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 3.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 3.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56 3.4.4 program counter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 3.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . .58 3.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . .60 3.6 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .60 3.7 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 3.8 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 section 4. clock generator module (cgmb) 4.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 4.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 7 non-disclosure agreement required 4.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 4.4.1 crystal oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . .73 4.4.2 phase-locked loop circuit (pll) . . . . . . . . . . . . . . . . . . . .73 4.4.2.1 pll circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 4.4.2.2 acquisition and tracking modes . . . . . . . . . . . . . . . . . . .75 4.4.2.3 manual and automatic pll bandwidth modes . . . . . . . .75 4.4.2.4 programming the pll . . . . . . . . . . . . . . . . . . . . . . . . . . .77 4.4.2.5 special programming exceptions . . . . . . . . . . . . . . . . . .80 4.4.3 base clock selector circuit. . . . . . . . . . . . . . . . . . . . . . . . .80 4.4.4 cgmb external connections . . . . . . . . . . . . . . . . . . . . . . .81 4.5 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 4.5.1 crystal amplifier input pin (osc1) . . . . . . . . . . . . . . . . . . .82 4.5.2 crystal amplifier output pin (osc2) . . . . . . . . . . . . . . . . . .82 4.5.3 external filter capacitor pin (cgmxfc). . . . . . . . . . . . . . .83 4.5.4 pll analog power pin (v dda 1 ) . . . . . . . . . . . . . . . . . . . . . .83 4.5.5 pll analog ground pin (v ssa1 ) . . . . . . . . . . . . . . . . . . . . .83 4.5.6 buffered crystal clock output (cgmvout) . . . . . . . . . . . .83 4.5.7 cgmvsel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 4.5.8 oscillator enable signal (simoscen) . . . . . . . . . . . . . . . .84 4.5.9 crystal output frequency signal (cgmxclk) . . . . . . . . . .84 4.5.10 cgmb base clock output (cgmout) . . . . . . . . . . . . . . . .84 4.5.11 cgmb cpu interrupt (cgmint) . . . . . . . . . . . . . . . . . . . . .84 4.6 cgmb registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 4.6.1 pll control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 4.6.2 pll bandwidth control register . . . . . . . . . . . . . . . . . . . . .90 4.6.3 pll multiplier select register high. . . . . . . . . . . . . . . . . . .92 4.6.4 pll multiplier select register low . . . . . . . . . . . . . . . . . . .93 4.6.5 pll vco range select register . . . . . . . . . . . . . . . . . . . .94 4.6.6 pll reference divider select register. . . . . . . . . . . . . . . .95 4.7 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8 special modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 4.9 cgmb during break interrupts. . . . . . . . . . . . . . . . . . . . . . . . .97 4.10 acquisition/lock time specifications . . . . . . . . . . . . . . . . . . . .98 4.10.1 acquisition/lock time definitions . . . . . . . . . . . . . . . . . . . .98 4.10.2 parametric influences on reaction time . . . . . . . . . . . . . .99
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 8 table of contents motorola 4.10.3 choosing a filter capacitor. . . . . . . . . . . . . . . . . . . . . . . .100 4.10.4 reaction time calculation . . . . . . . . . . . . . . . . . . . . . . . .101 section 5. computer operating properly (cop) module 5.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 5.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 5.4 i/o signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.1 cgmxclk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.2 stop instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.3 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.4 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.5 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.6 reset vetor fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.7 copd (cop disable) . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.8 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 5.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 5.9 cop module during break interrupts . . . . . . . . . . . . . . . . . . .107 section 6. keyboard interrupt (kbi) module 6.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 6.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 6.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 6.5 initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 9 non-disclosure agreement required 6.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.7 kbi during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .114 6.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 6.8.1 keyboard status and control register . . . . . . . . . . . . . . .114 6.8.2 keyboard interrupt enable register . . . . . . . . . . . . . . . . .116 section 7. system integration module (sim) 7.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 7.3 sim bus clock control and generation . . . . . . . . . . . . . . . . .121 7.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121 7.3.2 clock start-up from por or lvi reset . . . . . . . . . . . . . . .121 7.3.3 clocks in stop mode and wait mode . . . . . . . . . . . . . . . .122 7.4 reset and system initialization. . . . . . . . . . . . . . . . . . . . . . . .122 7.4.1 external pin reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 7.4.2 active resets from internal sources . . . . . . . . . . . . . . . . .124 7.4.2.1 power-on reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 7.4.2.2 computer operating properly (cop) reset. . . . . . . . . .126 7.4.2.3 illegal opcode reset . . . . . . . . . . . . . . . . . . . . . . . . . . .126 7.4.2.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . .126 7.4.2.5 low-voltage inhibit (lvi) reset . . . . . . . . . . . . . . . . . . .127 7.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 7.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . .127 7.5.2 sim counter during stop mode recovery . . . . . . . . . . . .128 7.5.3 sim counter and reset states . . . . . . . . . . . . . . . . . . . . .128 7.6 exception control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128 7.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 7.6.1.1 hardware interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . .131 7.6.1.2 swi instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.3 break interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.4 status flag protection in break mode. . . . . . . . . . . . . . . .132
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 10 table of contents motorola 7.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133 7.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133 7.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135 7.8 sim registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136 7.8.1 sim break status register . . . . . . . . . . . . . . . . . . . . . . . .136 7.8.2 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . .138 7.8.3 sim break flag control register . . . . . . . . . . . . . . . . . . .139 section 8. random-access memory (ram) 8.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 8.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 section 9. 2-kbyte flash memory 9.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 9.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144 9.4 flash 3 control register . . . . . . . . . . . . . . . . . . . . . . . . . . .145 9.5 flash 3 block protect register. . . . . . . . . . . . . . . . . . . . . . .147 9.6 block protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.7 charge pump frequency control . . . . . . . . . . . . . . . . . . . . . .148 9.8 flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149 9.9 flash program and margin read operation . . . . . . . . . . . .150 section 10. 48-kbyte flash memory 10.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153 10.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 10.4 flash 1control register . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10.5 flash 2 control register . . . . . . . . . . . . . . . . . . . . . . . . . . .155
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 11 non-disclosure agreement required 10.6 flash 1 block protect register. . . . . . . . . . . . . . . . . . . . . . .158 10.7 flash 2 block protect register. . . . . . . . . . . . . . . . . . . . . . .159 10.8 block protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 10.9 charge pump frequency control . . . . . . . . . . . . . . . . . . . . . .161 10.10 flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 10.11 flash program and margin read operation . . . . . . . . . . . .162 section 11. serial peripheral interface (spi) module 11.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.1 master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 11.5 slave mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 11.6 transmission formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171 11.6.1 clock phase and polarity controls . . . . . . . . . . . . . . . . . .171 11.6.2 transmission format when cpha = 0 . . . . . . . . . . . . . . .171 11.6.3 transmission format when cpha = 1 . . . . . . . . . . . . . . .173 11.6.4 transmission initiation latency . . . . . . . . . . . . . . . . . . . . .174 11.7 queuing transmission data . . . . . . . . . . . . . . . . . . . . . . . . . .176 11.8 error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 11.8.1 overflow error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 11.8.2 mode fault error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 11.9 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 11.10 resetting the spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 11.11 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 11.12 spi during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .185 11.13 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 11.13.1 miso (master in/slave out) . . . . . . . . . . . . . . . . . . . . . . .186 11.13.2 mosi (master out/slave in) . . . . . . . . . . . . . . . . . . . . . . .186 11.13.3 spsck (serial clock) . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 11.13.4 ss (slave select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 12 table of contents motorola 11.13.5 cgnd (clock ground) . . . . . . . . . . . . . . . . . . . . . . . . . . .188 11.14 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 11.14.1 spi control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 11.14.2 spi status and control register . . . . . . . . . . . . . . . . . . .192 11.14.3 spi data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 section 12. serial communications interface (sci) module 12.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 12.4.1 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2 transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2.2 character transmission . . . . . . . . . . . . . . . . . . . . . . . . .203 12.4.2.3 break characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204 12.4.2.4 idle characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 12.4.2.5 inversion of transmitted output. . . . . . . . . . . . . . . . . . .205 12.4.2.6 transmitter interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.2 character reception . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.3 data sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 12.4.3.4 framing errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 12.4.3.5 baud rate tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . .210 12.4.3.6 receiver wakeup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .213 12.4.3.7 receiver interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.4.3.8 error interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.6 sci during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .215
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 13 non-disclosure agreement required 12.7 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 12.7.1 ptg2/txd (transmit data) . . . . . . . . . . . . . . . . . . . . . . . .216 12.7.2 ptg1/rxd (receive data) . . . . . . . . . . . . . . . . . . . . . . . .216 12.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 12.8.1 sci control register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . .217 12.8.2 sci control register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . .220 12.8.3 sci control register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . .222 12.8.4 sci status register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 12.8.5 sci status register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 12.8.6 sci data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 12.8.7 sci baud rate register . . . . . . . . . . . . . . . . . . . . . . . . . .229 section 13. analog-to-digital converter (adc) module 13.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 13.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4.1 adc port i/o pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4.2 voltage conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 13.4.3 conversion time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.4.4 conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.4.5 accuracy and precision. . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.7 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.7.1 adc analog power pin (v dda2 ) . . . . . . . . . . . . . . . . . . . .237 13.7.2 adc analog ground pin (v ssa2 ) . . . . . . . . . . . . . . . . . . .238 13.7.3 adc voltage reference pin (v rh ) . . . . . . . . . . . . . . . . . .238 13.7.4 adc voltage in (advin) . . . . . . . . . . . . . . . . . . . . . . . . . .238 13.8 input/output registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .238 13.8.1 adc status and control register . . . . . . . . . . . . . . . . . . .238 13.8.2 adc data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241 13.8.3 adc clock register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 14 table of contents motorola section 14. configuration register (config) 14.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243 14.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243 section 15. timer interface module (tim) 15.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.4.1 timer counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.2 input capture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.3.1 unbuffered output compare . . . . . . . . . . . . . . . . . . . . .252 15.4.3.2 buffered output compare . . . . . . . . . . . . . . . . . . . . . . .253 15.4.4 pulse width modulation (pwm) . . . . . . . . . . . . . . . . . . . .254 15.4.4.1 unbuffered pwm signal generation . . . . . . . . . . . . . . .255 15.4.4.2 buffered pwm signal generation . . . . . . . . . . . . . . . . .256 15.4.4.3 pwm initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257 15.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.7 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .260 15.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260 15.8.1 tim clock pin (ptg3/tclk) . . . . . . . . . . . . . . . . . . . . . . .261 15.8.2 timer channel i/o pins (ptg4/tch0Cptg7/tch3) . . . .261 15.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 15.9.1 timer status and control register . . . . . . . . . . . . . . . . . .262 15.9.2 timer counter registers . . . . . . . . . . . . . . . . . . . . . . . . .264 15.9.3 timer modulo registers . . . . . . . . . . . . . . . . . . . . . . . . . .265 15.9.4 timer channel status and control registers . . . . . . . . . .266 15.9.5 timer channel registers. . . . . . . . . . . . . . . . . . . . . . . . . .271
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 15 non-disclosure agreement required section 16. timebase module (timtbx) 16.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 16.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 16.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 16.5 timebase control register description . . . . . . . . . . . . . . . . .277 16.6 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 section 17. input/output (i/o) ports 17.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282 17.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 17.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 17.3.2 data direction register a . . . . . . . . . . . . . . . . . . . . . . . . .284 17.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 17.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 17.4.2 data direction register b . . . . . . . . . . . . . . . . . . . . . . . . .286 17.5 port c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 17.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 17.5.2 data direction register c . . . . . . . . . . . . . . . . . . . . . . . . .288 17.6 port d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 17.6.1 port d data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 17.6.2 data direction register d . . . . . . . . . . . . . . . . . . . . . . . . .290 17.7 port e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 17.7.1 port e data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 17.7.2 data direction register e . . . . . . . . . . . . . . . . . . . . . . . . .292 17.8 port f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 17.8.1 port f data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 17.8.2 data direction register f . . . . . . . . . . . . . . . . . . . . . . . . .294
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 16 table of contents motorola 17.9 port g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296 17.9.1 port g data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .296 17.9.2 data direction register g . . . . . . . . . . . . . . . . . . . . . . . .296 section 18. monitor rom (mon) 18.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 18.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 18.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300 18.4.1 entering monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . .300 18.4.2 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18.4.3 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18.4.4 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 18.4.5 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 18.4.6 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 section 19. break module 19.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309 19.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310 19.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310 19.4.1 flag protection during break interrupts . . . . . . . . . . . . . .312 19.4.2 cpu during break interrupts. . . . . . . . . . . . . . . . . . . . . . .312 19.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . .312 19.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . .312 19.4.5 cop during break. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 19.5 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 19.5.1 break status and control register . . . . . . . . . . . . . . . . . .313 19.5.2 break address registers. . . . . . . . . . . . . . . . . . . . . . . . . .314 19.6 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
table of contents mc68hc(9)08pt48 rev. 2.0 advance information motorola table of contents 17 non-disclosure agreement required section 20. external interrupt module (irq) 20.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 20.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 20.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 20.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316 20.4.1 irq1 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319 20.4.2 irq2 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320 20.5 irq module during break interrupts . . . . . . . . . . . . . . . . . . .321 20.6 irq status and control register . . . . . . . . . . . . . . . . . . . . . .321 section 21. alert output generator (alr) 21.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 21.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 21.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 21.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 21.4.1 alert control register . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 21.4.2 sound pressure level circuit . . . . . . . . . . . . . . . . . . . . . .328 21.4.3 alert data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329 section 22. electrical specifications 22.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331 22.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331 22.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . .332 22.4 functional operating range. . . . . . . . . . . . . . . . . . . . . . . . . .333 22.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 22.6 3.0-volt dc electrical characteristics. . . . . . . . . . . . . . . . . . .334 22.7 2.0-volt dc electrical characteristics. . . . . . . . . . . . . . . . . . .335 22.8 ram retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 22.9 3.0-volt control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 22.10 2.0-volt control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336
non-disclosure agreement required table of contents advance information mc68hc(9)08pt48 rev. 2.0 18 table of contents motorola 22.11 3.0-volt spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . .337 22.12 2.0-volt spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . .338 22.13 pll2p12m electrical specifications . . . . . . . . . . . . . . . . . . . .341 22.14 pll2p12m component specifications . . . . . . . . . . . . . . . . . .341 22.15 bus clock pll acquisition/lock time specifications . . . . . . .342 22.16 2-k flash memory electrical characteristics . . . . . . . . . . . .343 22.17 48-k flash memory electrical characteristics . . . . . . . . . . .343 22.18 adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344 section 23. mechanical data 23.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 23.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 23.3 80-pin lqfp (case 917-01) . . . . . . . . . . . . . . . . . . . . . . . . . .346 section 24. ordering information 24.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347 24.2 mcu ordering forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347 24.3 application program media. . . . . . . . . . . . . . . . . . . . . . . . . . .348 24.4 rom program verification . . . . . . . . . . . . . . . . . . . . . . . . . . .349 24.5 rom verification units (rvus). . . . . . . . . . . . . . . . . . . . . . . .350 24.6 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350
mc68hc(9)08pt48 rev. 2.0 advance information motorola list of figures 19 non-disclosure agreement required advance information mc68hc(9)08pt48 list of figures figure title page 1-1 mc68hc(9)08pt48 block diagram . . . . . . . . . . . . . . . . . . .30 1-2 mc68hc(9)08pt48 pinout (top view) . . . . . . . . . . . . . . . .31 1-3 power supply bypassing . . . . . . . . . . . . . . . . . . . . . . . . . . .32 1-4 crystal connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 2-1 memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 2-2 mc68hc(9)08pt48 register map . . . . . . . . . . . . . . . . . . . .40 2-3 control, status, and data registers. . . . . . . . . . . . . . . . . . .40 2-4 vector addresses in flash/rom . . . . . . . . . . . . . . . . . . . .50 3-1 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 3-2 accumulator (a) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3-3 index register (h:x). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3-4 stack pointer (sp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56 3-5 program counter (pc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 3-6 condition code register (ccr) . . . . . . . . . . . . . . . . . . . . . .58 4-1 cgmb block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 4-2 cgmb external connections . . . . . . . . . . . . . . . . . . . . . . . .82 4-3 cgmb i/o register summary . . . . . . . . . . . . . . . . . . . . . . .86 4-4 pll control register (pctl) . . . . . . . . . . . . . . . . . . . . . . . .87 4-5 pll bandwidth control register (pbwc) . . . . . . . . . . . . . .90 4-6 pll multiplier select register high (pmsh) . . . . . . . . . . . .92 4-7 pll multiplier select register low (pmsl) . . . . . . . . . . . . .93 4-8 pll vco range select register (pvrs) . . . . . . . . . . . . . .94 4-9 pll reference divider select register (prds) . . . . . . . . .95 5-1 cop block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 5-2 cop control register (copctl). . . . . . . . . . . . . . . . . . . .106
non-disclosure agreement required list of figures advance information mc68hc(9)08pt48 rev. 2.0 20 list of figures motorola figure title page 6-1 kbi block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 6-2 kbi register summary. . . . . . . . . . . . . . . . . . . . . . . . . . . .110 6-3 keyboard status and control register (kbscr) . . . . . . . .115 6-4 keyboard interrupt enable register (kber) . . . . . . . . . . .116 7-1 sim block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 7-2 sim i/o register summary . . . . . . . . . . . . . . . . . . . . . . . .120 7-3 cgm clock signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121 7-4 external reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 7-5 internal reset timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124 7-6 sources of internal reset. . . . . . . . . . . . . . . . . . . . . . . . . .124 7-7 por recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 7-8 interrupt entry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 7-9 interrupt recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 7-10 interrupt processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130 7-11 interrupt recognition example . . . . . . . . . . . . . . . . . . . . . .131 7-12 wait mode entry timing . . . . . . . . . . . . . . . . . . . . . . . . . . .133 7-13 wait recovery from interrupt or break . . . . . . . . . . . . . . . .134 7-14 wait recovery from internal reset . . . . . . . . . . . . . . . . . .134 7-15 stop mode entry timing. . . . . . . . . . . . . . . . . . . . . . . . . . .135 7-16 stop mode recovery from interrupt or break. . . . . . . . . . .136 7-17 sim break status register (sbsr) . . . . . . . . . . . . . . . . . .136 7-18 sim reset status register (srsr) . . . . . . . . . . . . . . . . . .138 7-19 sim break flag control register (sbfcr) . . . . . . . . . . . .139 9-1 flash 3 control register (fl3cr) . . . . . . . . . . . . . . . . . .145 9-2 flash 3 block protect register (fl3bpr) . . . . . . . . . . . .147 9-3 page program algorithm . . . . . . . . . . . . . . . . . . . . . . . . . .151 10-1 flash 1 control register (fl1cr) . . . . . . . . . . . . . . . . . .155 10-2 flash 2 control register (fl2cr) . . . . . . . . . . . . . . . . . .155 10-3 flash 1 block protect register (fl1bpr) . . . . . . . . . . . .158 10-4 flash 2 block protect register (fl2bpr) . . . . . . . . . . . .159 10-5 page program algorithm . . . . . . . . . . . . . . . . . . . . . . . . . .164
list of figures mc68hc(9)08pt48 rev. 2.0 advance information motorola list of figures 21 non-disclosure agreement required figure title page 11-1 spi module block diagram . . . . . . . . . . . . . . . . . . . . . . . .167 11-2 spi i/o register summary . . . . . . . . . . . . . . . . . . . . . . . . .168 11-3 full-duplex master-slave connections . . . . . . . . . . . . . . .169 11-4 transmission format (cpha = 0) . . . . . . . . . . . . . . . . . . .172 11-5 cpha/ ss timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 11-6 transmission format (cpha = 1) . . . . . . . . . . . . . . . . . . .174 11-7 transmission start delay (master) . . . . . . . . . . . . . . . . . . .175 11-8 sprf/spte cpu interrupt timing. . . . . . . . . . . . . . . . . . .176 11-9 missed read of overflow condition . . . . . . . . . . . . . . . . . .178 11-10 clearing sprf when ovrf interrupt is not enabled . . . .179 11-11 spi interrupt request generation . . . . . . . . . . . . . . . . . . .183 11-12 cpha/ ss timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 11-13 spi control register (spcr) . . . . . . . . . . . . . . . . . . . . . . .190 11-14 spi status and control register (spscr). . . . . . . . . . . . .192 11-15 spi data register (spdr) . . . . . . . . . . . . . . . . . . . . . . . . .195 12-1 sci module block diagram . . . . . . . . . . . . . . . . . . . . . . . .200 12-2 sci i/o register summary. . . . . . . . . . . . . . . . . . . . . . . . .201 12-3 sci data formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12-4 sci transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203 12-5 sci receiver block diagram . . . . . . . . . . . . . . . . . . . . . . .207 12-6 receiver data sampling. . . . . . . . . . . . . . . . . . . . . . . . . . .208 12-7 slow data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 12-8 fast data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 12-9 sci control register 1 (scc1) . . . . . . . . . . . . . . . . . . . . .217 12-10 sci control register 2 (scc2) . . . . . . . . . . . . . . . . . . . . .220 12-11 sci control register 3 (scc3) . . . . . . . . . . . . . . . . . . . . .223 12-12 sci status register 1 (scs1) . . . . . . . . . . . . . . . . . . . . . .225 12-13 sci status register 2 (scs2) . . . . . . . . . . . . . . . . . . . . . .228 12-14 sci data register (scdr) . . . . . . . . . . . . . . . . . . . . . . . . .229 12-15 sci baud rate register (scbr) . . . . . . . . . . . . . . . . . . . .229 13-1 adc block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 13-2 adc status and control register (adscr). . . . . . . . . . . .238 13-3 adc data register (adr) . . . . . . . . . . . . . . . . . . . . . . . . .241 13-4 adc clock register (adclkr) . . . . . . . . . . . . . . . . . . . . .241
non-disclosure agreement required list of figures advance information mc68hc(9)08pt48 rev. 2.0 22 list of figures motorola figure title page 14-1 configuration register (config) . . . . . . . . . . . . . . . . . . .244 14-2 mask option register (mor) . . . . . . . . . . . . . . . . . . . . . . .244 15-1 tim block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 15-2 timer i/o register summary . . . . . . . . . . . . . . . . . . . . . . .250 15-3 pwm period and pulse width . . . . . . . . . . . . . . . . . . . . . .255 15-4 timer status and control register (tsc) . . . . . . . . . . . . .262 15-5 timer counter register high (tcnth) . . . . . . . . . . . . . . .264 15-6 timer counter register low (tcntl) . . . . . . . . . . . . . . . .264 15-7 timer modulo register high (tmodh) . . . . . . . . . . . . . . .265 15-8 timer modulo register low (tmodl) . . . . . . . . . . . . . . . .265 15-9 timer channel 0 status and control register (tsc0) . . . .266 15-10 timer channel 1 status and control register (tsc1) . . . .266 15-11 timer channel 2 status and control register (tsc2) . . . .267 15-12 timer channel 3 status and control register (tsc3) . . . .267 15-13 chxmax latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270 15-14 timer channel 0 register high (tch0h). . . . . . . . . . . . . .271 15-15 timer channel 0 register low (tch0l) . . . . . . . . . . . . . .271 15-16 timer channel 1 register high (tch1h). . . . . . . . . . . . . .272 15-17 timer channel 1 register low (tch1l) . . . . . . . . . . . . . .272 15-18 timer channel 2 register high (tch2h). . . . . . . . . . . . . .272 15-19 timer channel 2 register low (tch2l) . . . . . . . . . . . . . .272 15-20 timer channel 3 register high (tch3h). . . . . . . . . . . . . .273 15-21 timer channel 3 register low (tch3l) . . . . . . . . . . . . . .273 16-1 timebase block diagram . . . . . . . . . . . . . . . . . . . . . . . . . .276 16-2 timebase control register (tbxcr) . . . . . . . . . . . . . . . . .277 17-1 i/o port registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282 17-2 port a data register (pta) . . . . . . . . . . . . . . . . . . . . . . . .284 17-3 data direction register a (ddra) . . . . . . . . . . . . . . . . . . .284 17-4 port a i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285 17-5 port b data register (ptb) . . . . . . . . . . . . . . . . . . . . . . . .286 17-6 data direction register b (ddrb) . . . . . . . . . . . . . . . . . . .286 17-7 port b i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287 17-8 port c data register (ptc) . . . . . . . . . . . . . . . . . . . . . . . .288
list of figures mc68hc(9)08pt48 rev. 2.0 advance information motorola list of figures 23 non-disclosure agreement required figure title page 17-9 data direction register c (ddrc) . . . . . . . . . . . . . . . . . . .288 17-10 port c i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289 17-11 port d data register (ptd) . . . . . . . . . . . . . . . . . . . . . . . .290 17-12 data direction register d (ddrd) . . . . . . . . . . . . . . . . . . .290 17-13 port d i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 17-14 port e data register (pte) . . . . . . . . . . . . . . . . . . . . . . . .292 17-15 data direction register e (ddre) . . . . . . . . . . . . . . . . . . .292 17-16 port e i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293 17-17 port f data register (ptf) . . . . . . . . . . . . . . . . . . . . . . . .294 17-18 data direction register f (ddrf) . . . . . . . . . . . . . . . . . . .294 17-19 port f i/o circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295 17-20 port g data register (ptg) . . . . . . . . . . . . . . . . . . . . . . . .296 17-21 data direction register g (ddrg) . . . . . . . . . . . . . . . . . .296 17-22 port g i/o circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .297 18-1 monitor mode circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301 18-2 monitor data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18-3 sample monitor waveforms . . . . . . . . . . . . . . . . . . . . . . . .303 18-4 read transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18-5 break transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 19-1 break module block diagram . . . . . . . . . . . . . . . . . . . . . . .311 19-2 break i/o register summary . . . . . . . . . . . . . . . . . . . . . . .311 19-3 break status and control register (brkscr) . . . . . . . . .313 19-4 break address register high (brkh) . . . . . . . . . . . . . . . .314 19-5 break address register low (brkl) . . . . . . . . . . . . . . . . .314 20-1 irq module block diagram . . . . . . . . . . . . . . . . . . . . . . . .317 20-2 irq interrupt flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . .318 20-3 irq status and control register (iscr) . . . . . . . . . . . . . .322 21-1 alert control register (alcr) . . . . . . . . . . . . . . . . . . . . . .327 21-2 block diagram of spl reduction circuit . . . . . . . . . . . . . .328 21-3 alert data register (aldr) . . . . . . . . . . . . . . . . . . . . . . . .329
non-disclosure agreement required list of figures advance information mc68hc(9)08pt48 rev. 2.0 24 list of figures motorola figure title page 22-1 spi master timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339 22-2 spi slave timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
mc68hc(9)08pt48 rev. 2.0 advance information motorola list of tables 25 non-disclosure agreement required advance information mc68hc(9)08pt48 list of tables table title page 3-1 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 3-2 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 4-1 numeric example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 4-2 pre1 and pre0 programming . . . . . . . . . . . . . . . . . . . . . . .89 4-3 vpr1 and vpr0 programming . . . . . . . . . . . . . . . . . . . . . . .89 7-1 signal name convention . . . . . . . . . . . . . . . . . . . . . . . . . . .120 7-2 pin bit set timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 7-3 sim registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136 9-1 erase block sizes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 9-2 charge pump clock frequency . . . . . . . . . . . . . . . . . . . . . .149 10-1 32-kbyte erase block sizes . . . . . . . . . . . . . . . . . . . . . . . . .156 10-2 16-kbyte erase block sizes . . . . . . . . . . . . . . . . . . . . . . . . .156 10-3 charge pump clock frequency . . . . . . . . . . . . . . . . . . . . . .161 11-1 spi interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 11-2 spi configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 11-3 spi master baud rate selection . . . . . . . . . . . . . . . . . . . . .194 12-1 start bit verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 12-2 data bit recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 12-3 stop bit recovery. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 12-4 character format selection . . . . . . . . . . . . . . . . . . . . . . . . .219 12-5 sci baud rate prescaling . . . . . . . . . . . . . . . . . . . . . . . . . .230 12-6 sci baud rate selection . . . . . . . . . . . . . . . . . . . . . . . . . . .230 12-7 sci baud rate selection examples . . . . . . . . . . . . . . . . . . .232
non-disclosure agreement required list of tables advance information mc68hc(9)08pt48 rev. 2.0 26 list of tables motorola table title page 13-1 mux channel select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240 13-2 adc clock divide ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . .242 15-1 prescaler selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 15-2 mode, edge, and level selection. . . . . . . . . . . . . . . . . . . . .269 16-1 timebase rate selection . . . . . . . . . . . . . . . . . . . . . . . . . . .277 16-2 input crystal frequency selection . . . . . . . . . . . . . . . . . . . .278 17-1 port a pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285 17-2 port b pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287 17-3 port c pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289 17-4 port d pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 17-5 port e pin functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293 17-6 port f pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .295 17-7 port g pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .297 18-1 mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300 18-2 mode differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .302 18-3 read (read memory) command . . . . . . . . . . . . . . . . . . . .305 18-4 write (write memory) command. . . . . . . . . . . . . . . . . . . .305 18-5 read (indexed read) command . . . . . . . . . . . . . . . . . . . .306 18-6 iwrite (indexed write) command . . . . . . . . . . . . . . . . . . .306 18-7 readsp (read stack pointer) command. . . . . . . . . . . . . .307 18-8 run (run user program) command. . . . . . . . . . . . . . . . . .307 18-9 monitor baud rate selection . . . . . . . . . . . . . . . . . . . . . . . .308 21-1 audio alert tone generator divider ratios. . . . . . . . . . . . . .326 21-2 clock divider and modulator selections . . . . . . . . . . . . . . .329 21-3 duty cycle selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330 24-1 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350
mc68hc(9)08pt48 rev. 2.0 advance information motorola general description 27 non-disclosure agreement required advance information mc68hc(9)08pt48 section 1. general description 1.1 contents 1.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 1.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 1.4 mcu block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 1.5 pin assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.6 pin functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 1.6.1 power supply pins (v dd , v ss , ev dd1-4 , ev ss1-4 ,v dda1,2 ,v ssa1,2 ). . . . . . . . . . . . . . . . . . . . . . . .32 1.6.2 oscillator pins (osc1 and osc2) . . . . . . . . . . . . . . . . . . .33 1.6.3 external reset pin ( rst) . . . . . . . . . . . . . . . . . . . . . . . . . .33 1.6.4 external interrupt pin ( irq1). . . . . . . . . . . . . . . . . . . . . . . .34 1.6.5 external interrupt pin ( irq2). . . . . . . . . . . . . . . . . . . . . . . .34 1.6.6 external filter capacitor pins (pllxfc). . . . . . . . . . . . . . .34 1.6.7 port a i/o pins (pta7Cpta0) . . . . . . . . . . . . . . . . . . . . . . .34 1.6.8 port b i/o pins (ptb7Cptb0) . . . . . . . . . . . . . . . . . . . . . . .34 1.6.9 port c i/o pins (ptc7Cptc0). . . . . . . . . . . . . . . . . . . . . . .34 1.6.10 port d i/o pins (ptd7Cptd0). . . . . . . . . . . . . . . . . . . . . . .34 1.6.11 port e i/o pins (pte7/ad3Cpte4/ad0 and pte3/miso-pte0/ss) . . . . . . . . . . . . . . . . . . . . . .35 1.6.12 port f i/o pins (ptf7/kbd7Cptf0/kbd0) . . . . . . . . . . . . .35 1.6.13 port g i/o pins (ptg7/tch3Cptg3/tclk, ptg2/txd, ptg1/rxd, and ptg0) . . . . . . . . . . . . . . . .35 1.6.14 alert generator output (alert) . . . . . . . . . . . . . . . . . . . . .35 1.6.15 adc voltage reference pin (v rh ) . . . . . . . . . . . . . . . . . . .35
non-disclosure agreement required general description advance information mc68hc(9)08pt48 rev. 2.0 28 general description motorola 1.2 introduction the mc68hc(9)08pt48 is a member of the low-cost, low-power, high- performance m68hc08 family of 8-bit microcontroller units (mcus). the m68hc08 family is based on the customer-specified integrated circuit (csic) design strategy. all mcus in the family use the enhanced m68hc08 central processor unit (cpu08) and are available with a variety of modules, memory sizes and types, and package types. 1.3 features features of the mc68hc(9)08pt48 include: ? high-performance m68hc08 architecture ? fully upward-compatible object code with m6805, m146805, and m68hc05 families ? on-chip flash/rom of 48 kbytes ? on-chip flash of 2 kbytes separate from program rom/flash ? rom data security 1 option (no security option for mc68hc908pt48) ? configuration register (config) ? 2.5 kbytes of on-chip mcu random-access memory (ram) ? 56 general-purpose input/output (i/o) pins ? programmable phase locked loop (pll) for bus clock generation ? serial peripheral interface module (spi) ? serial communications interface module (sci) ? timebase module (tbm) with software selection of crystal clock source ? two external interrupt request pins ? alert generator module (alr) 1. no security feature is absolutely secure. however, motorolas strategy is to make reading or copying the flash difficult for unauthorized users.
general description mcu block diagram mc68hc(9)08pt48 rev. 2.0 advance information motorola general description 29 non-disclosure agreement required ? 16-bit, 4-channel timer interface module (tim) ? computer operating properly (cop) reset ? 8-bit, 4-channel analog-to-digital converter (adc) ? system protection features: C illegal opcode detect reset C illegal address detect reset ? packaged in an 80-pin quad flat pack (lqfp) ? low-power design (fully static with stop and wait modes) ? master reset pin and power-on reset (por) features of the cpu08 include: ? enhanced hc05 programming model ? extensive loop control functions ? 16 addressing modes (eight more than the hc05) ? 16-bit index register and stack pointer ? fast 8 x 8 multiply instruction ? fast 16 ? 8 divide instruction ? binary coded decimal (bcd) instructions ? optimization for controller applications ? high-level language (c language) support 1.4 mcu block diagram figure 1-1 shows the structure of the mc68hc(9)08pt48.
non-disclosure agreement required general description advance information mc68hc(9)08pt48 rev. 2.0 30 general description motorola figure 1-1. mc68hc(9)08pt48 block diagram ram 2.5 kbytes control/status registers 15 87 0 7 0 15 0 15 0 7 0 vc z n i h a h:x sp pc ccr cpu control arithmetic/ logic unit (alu) pta serial peripheral interface module timer module ptaddr pta0 pta1 pta2 pta3 pta4 pta5 pta6 pta7 osc1 data & address bus time base module power ev dd ev ss ptb ptbddr ptc ptcddr clock generation modules monitor rom 240 bytes user flash/rom 48,640 bytes rst irq1 system integration module osc2 pllxfc v dd v ss irq2 ptb0 ptb1 ptb2 ptb3 ptb4 ptb5 ptb6 ptb7 ptc0 ptc1 ptc2 ptc3 ptc4 sci module user flash/rom vectors flash prom 2 kbytes ptc5 ptc6 ptc7 ptd ptdddr ptd0 ptd1 ptd2 ptf3/kbd3 ptf4/kbd4 ptf5/kbd5 ptf6/kbd6 ptf7/kbd7 pte pteddr pte0/ ss pte1/spsck pte2/mosi pte3/miso pte4/ad0 pte5/ad1 pte6/ad2 pte7/ad3 system management module analog to digital convertor vrh 4 4 v dda v ssa 2 2 computer operating alert module generator properly module keyboard module interrupt 2 ptf ptfddr ptf0/kbd0 ptf1/kbd1 ptf2/kbd2 ptd3 ptd4 ptd5 ptd6 ptd7 ptg ptgddr ptg0 ptg1/rxd ptg2/txd ptg3/tclk ptg4/tch0 ptg5/tch1 ptg6/tch2 ptg7/tch3 alert 2 80 bytes 44 bytes
general description pin assignments mc68hc(9)08pt48 rev. 2.0 advance information motorola general description 31 non-disclosure agreement required 1.5 pin assignments pin assignments for the mc68hc(9)08pt48 are shown in figure 1-2 . figure 1-2. mc68hc(9)08pt48 pinout (top view) 1.6 pin functions descriptions of the pin functions are provided here. pa3 ev ss1 ev dd2 pa2 pa1 pa0 v dd ev dd4 osc2 osc1 pa4 pa5 pa6 pta7 ev dd4 ev ss4 pb0 pb1 pf4/kbd4 pf3/kbd3 pf2/kbd2 pf1/kbd1 pf0/kbd0 v ss v dd v dda2 v rh pe7/ad3 pe6/ad2 pe5/ad1 pe4/ad0 v ssa2 ev ss2 ev dd1 pg7/tch3 pg6/tch2 pg5/tch1 pg4/tch0 pg3/tclk pg2/txd pg1/rxd v ssa1 pllxfc v dda1 alert irq2 rst irq1 pc0 pb6 pb7 pc1 pc2 pc3 pc4 pc5 pc6 pc7 ev ss3 ev dd3 pd0 pd1 pd2 pd3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 pd4 pd5 pd6 pd7 37 38 39 40 pb2 pb3 pb4 pb5 17 18 19 20 pe3/miso pe2/mosi pe1/spclk pe0/ ss 44 43 42 41 pg0 pf7/kbd7 pf6/kbd6 pf5/kbd5 64 63 62 61
non-disclosure agreement required general description advance information mc68hc(9)08pt48 rev. 2.0 32 general description motorola 1.6.1 power supply pins (v dd , v ss , ev dd1-4 , ev ss1-4 , v dda1,2 , v ssa1,2 ) v dd and v ss are power supply and ground pins for the digital sections of the mcu. the mcu operates from a single power supply ranging from 2 v 10% to 3 v 10%. the ev dd and ev ss pins are power supply and ground pins for the i/o section of the mcu. v dda1 and v ssa1 are used for the analog portion of the bus clock pll to reduce noise injected to the clocks. very fast signal transitions on mcu pins place high, short-duration current demands on the power supply. to prevent noise problems, take special care to provide good power supply bypassing at the mcu as shown in figure 1-3 . place the c1 bypass capacitor as close to the mcu as possible. use a high-frequency response ceramic capacitor for c1. c2 is an optional bulk current bypass capacitor for use in applications that require the port pins to source high current levels. ev ss2 pin is also the ground return pin for the serial clock in the serial peripheral interface module (spi). it enables the user to implement a coplanar transmission line for the spi clock on printed circuit boards (pcbs) with no ground plane. v ss can help reduce radiated radio frequency (rf) emissions by controlling trace impedance and minimizing radiating loop area. figure 1-3. power supply bypassing note: component values shown represent typical applications. mcu v dd c2 c1 0.1 m f v ss v dd +
general description pin functions mc68hc(9)08pt48 rev. 2.0 advance information motorola general description 33 non-disclosure agreement required 1.6.2 oscillator pins ( osc1 and osc2) the osc1 and osc2 pins are the crystal connections for the on-chip oscillator. figure 1-4 shows a typical crystal oscillator circuit for a parallel resonant crystal. follow the crystal suppliers recommendations, as the crystal parameters determine the external component values required to provide reliable start up and maximum stability. note: the load capacitance values used in the oscillator circuit design should include all stray layout capacitances. to minimize output distortion and rf emissions, mount the crystal and capacitors as close as possible to the pins. figure 1-4. crystal connections note: follow the crystal manufacturers recommendations for component sizes. 1.6.3 external reset pin ( rst) a logic 0 on the rst pin forces the mcu to a known startup state. rst is bidirectional, allowing a reset of the entire system. it is driven low when any internal reset source is asserted. see section 7. system integration module (sim) for more information. osc1 osc2 xtal mcu c1 c2
non-disclosure agreement required general description advance information mc68hc(9)08pt48 rev. 2.0 34 general description motorola 1.6.4 external interrupt pin ( irq1) irq1 is an asynchronous external interrupt pin. see section 20. external interrupt module (irq) for more information. 1.6.5 external interrupt pin ( irq2) irq2 is an asynchronous external interrupt pin. see section 20. external interrupt module (irq) for more information. 1.6.6 external filter capacitor pins (pllxfc) pllxfc is the external filter capacitor connections for the pll. see section 17. input/output (i/o) ports for more information. 1.6.7 port a i/o pins (pta7Cpta0) pta7Cpta0 are general-purpose bidirectional i/o port pins. see section 17. input/output (i/o) ports for more information. 1.6.8 port b i/o pins (ptb7Cptb0) ptb7Cptb0 are general-purpose bidirectional i/o port pins.see section 17. input/output (i/o) ports for more information. 1.6.9 port c i/o pins (ptc7Cptc0) ptc7Cptc0 are general-purpose bidirectional i/o port pins. see section 17. input/output (i/o) ports for more information. 1.6.10 port d i/o pins (ptd7Cptd0) ptd7Cptd0 are general-purpose bidirectional i/o port pins. see section 17. input/output (i/o) ports for more information.
general description pin functions mc68hc(9)08pt48 rev. 2.0 advance information motorola general description 35 non-disclosure agreement required 1.6.11 port e i/o pins (pte7/ad3Cpte4/ad0 and pte3/misoCpte0/ ss) port e is an 8-bit special function port that shares four of its pins with the adc and the other four pins with spi. 1.6.12 port f i/o pins (ptf7/kbd7Cptf0/kbd0) port f is an 8-bit special function port that shares with the keyboard interrupts. 1.6.13 port g i/o pins (ptg7/tch3Cptg3/tclk, ptg2/txd, ptg1/rxd, and ptg0) port g is an 8-bit special function port that shares five of its pins with the timer and two of its pins with sci. 1.6.14 alert generator output (alert) alert is the output from the alr. see 21.1 contents for more information. 1.6.15 adc voltage reference pin (v rh ) v rh is the power supply for setting the reference voltage v rh . connect the v rh pin to a voltage potential ? v dda2 , not less than 1.5 v. it supplies the resistor legs. ideally, route this to its own pad. it can be routed to v dda .
non-disclosure agreement required general description advance information mc68hc(9)08pt48 rev. 2.0 36 general description motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 37 non-disclosure agreement required advance information mc68hc(9)08pt48 section 2. memory map 2.1 contents 2.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 2.3 i/o section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 2.4 random-access memory (ram) . . . . . . . . . . . . . . . . . . . . . . .38 2.5 memory map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 2.6 user flash/rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 2.7 flash prom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 2.8 monitor rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 2.2 introduction the cpu08 can address 64 kbytes of memory space. the memory map, shown in figure 2-1 , includes: ? 48 kbytes of low-voltage flash/rom ? 2.5 kbytes of ram ? 2 kbytes of low-voltage flash separate from rom/emulation flash ? 44 bytes of user-defined vectors ? 240 bytes of monitor rom
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 38 memory map motorola 2.3 i/o section addresses $0000C$004f, shown in figure 2-1 , contain most of the control, status, and data registers. additional input/output (i/o) registers located in upper page memory are shown in figure 2-2 . 2.4 random-access memory (ram) the 2.5 kbyte addresses from $0050C$0a4f are ram locations. the location of the stack ram is programmable. the 16-bit stack pointer allows the stack to be anywhere in ram, allowing all page zero locations to be used for i/o control and user data or code. within page zero there are 176 bytes of ram. when the stack pointer is moved from its reset location at $00ff, direct addressing mode instructions can efficiently access all page zero ram locations. page zero ram therefore provides ideal locations for frequently accessed global variables. before processing an interrupt, the cpu uses five bytes of the stack to save the contents of the cpu registers. for m6805 compatibility, the h register is not stacked. during a subroutine call, the cpu uses two bytes of the stack to store the return address. the stack pointer decrements during pushes and increments during pulls. note: be careful when using nested subroutines or multiple interrupt levels. the cpu may overwrite data in the ram during a subroutine or during the interrupt stacking. 2.5 memory map see figure 2-1 , figure 2-2 , figure 2-3 , and figure 2-4 .
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 39 non-disclosure agreement required figure 2-1. memory map i/o 80 bytes stack 64 bytes user ram 2560 bytes (total) sim registers 16 bytes user vectors 36 bytes $0000 $00ff $0100 $0a4f $fdff $fe00 $feff $ffdc $ffff $0a50 monitor rom 240 bytes $fe10 page 0 176 bytes user ram $ffdb $ff00 sci control register 2 sci control register 3 sci status register 1 $18 $19 $1a $1b $1c $1d $1e $1f port a data register port b data register port c data register port d data register port a data direction register port b data direction register port e data register port g data register port f data register sci control register 1 port d data direction register unused port e data direction register port g data direction register $00 $01 $02 $03 $04 $05 $06 $07 $08 $09 $0a $0b $0c $0d $0e $0f $10 $11 $12 $13 $14 $15 $16 $17 spi control register spi status register spi data register unused unused port c data direction register irq status/control register 2-k flash block protect register *32-k flash block protect register sci status register 2 sci baud rate register unused unused sci data register port f data direction register unused $28 $29 $2a $2b $2c $2d $2e $2f $30 $31 $32 $33 $34 $35 $36 $37 unused configuration register unused $38 $39 $3a $3b $3c $3d $3e $3f $41 $42 $43 $44 $45 $46 $47 $40 tim channel 0 register low tim channel 1 status/control register tim channel 1 register high tim channel 1 register low tim channel 2 register low tim channel 3 status/control register tim channel 3 register high tim channel 3 register low unused keyboard status/control register keyboard interrupt enable register unused alert control register alert data register timebase control register unused unused unused unused unused unused unused unused unused pll bandwidth control register pll control register tim channel 2 register high tim channel 2 status/control register user flash/rom 48,640 bytes 220 bytes unused 3504 bytes unused $004f $0050 $17ff flash 2048 bytes $4000 $1fff unused 8192 bytes $1800 $2000 $3fff *mc68hc908pt48 only tim counter modulo register low tim channel 0 status/control register tim channel 0 register high tim status and control register tim counter register high tim counter modulo register high tim counter register low unused a/d data register a/d clock register *16-k flash block protect register pll multiplier select high register pll vco range select register a/d status/control register pll reference divider select register pll multiplier select low register $20 $21 $22 $23 $24 $25 $26 $27 $48 $49 $4a $4b $4c $4d $4e $4f
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 40 memory map motorola figure 2-2. mc68hc(9)08pt48 register map sim break status register sim registers 16 bytes $fe00 $fe0f $fe00 sim reset status register reserved sim break flag control register reserved reserved for -k flash test 2-k flash control register reserved for 16-k flash 1 test 16-k flash 2 control register reserved for 32-k flash 2 test 32-k flash 1 control register break address register (high) break address register (low) break status and control register reserved reserved $fe01 $fe02 $fe03 $fe04 $fe05 $fe06 $fe07 $fe08 $fe09 $fe0a $fe0b $fe0c $fe0d $fe0e $fe0f addr. register name bit 7 6 5 4 3 2 1 bit 0 $0000 port a data register (pta) read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset $0001 port b data register (ptb) read: ptb7 ptb6 ptb5 ptb4 ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset $0002 port c data register (ptc) read: ptc7 ptc6 ptc5 ptc4 ptc3 ptc2 ptc1 ptc0 write: reset: unaffected by reset $0003 port d data register (ptd) read: ptd7 ptd6 ptd5 ptd4 ptd3 ptd2 ptd1 ptd0 write: reset: unaffected by reset = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 1 of 10)
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 41 non-disclosure agreement required $0004 port a data direction register (ddra) read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset: 0 0 0 0 0 0 0 0 $0005 port b data direction register (ddrb) read: ddrb7 ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset: 0 0 0 0 0 0 0 0 $0006 port c data direction register (ddrc) read: ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 write: reset: 0 0 0 0 0 0 0 0 $0007 port d data direction register (ddrd) read: ddrd7 ddrd6 ddrd5 ddrd4 ddrd3 ddrd2 ddrd1 ddrd0 write: reset: 0 0 0 0 0 0 0 0 $0008 port e data register (pte) read: pte7 pte6 pte5 pte4 pte3 pte2 pte1 pte0 write: reset: unaffected by reset $0009 port f data register (ptf) read: ptf7 ptf6 ptf5 ptf4 ptf3 ptf2 ptf1 ptf0 write: reset: unaffected by reset $000a port g data register (ptg) read: ptg7 ptg6 ptg5 ptg4 ptg3 ptg2 ptg1 ptg0 write: reset: unaffected by reset $000b unimplemented $000c port e data direction register (ddre) read: ddre7 ddre6 ddre5 ddre4 ddre3 ddre2 ddre1 ddre0 write: reset: 0 0 0 0 0 0 0 0 $000d port f data direction register (ddrf) read: ddrf7 ddrf6 ddrf5 ddrf4 ddrf3 ddrf2 ddrf1 ddrf0 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 2 of 10)
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 42 memory map motorola $000e port g data direction register (ddrg) read: ddrg7 ddrg6 ddrg5 ddrg4 ddrg3 ddrg2 ddrg1 ddrg0 write: reset: 0 0 0 0 0 0 0 0 $000f spi control register (spcr) read: sprie dmas spmstr cpol cpha spwom spe sptie write: reset: 0 0 1 0 1 0 0 0 $0010 spi status and control register (spscr) read: sprf errie ovrf modf spte modfen spr1 spr0 write: reset: 0 0 0 0 1 0 0 0 $0011 spi data register (spdr) read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: indeterminate after reset $0012 unimplemented $0013 unimplemented $0014 sci control register 1 (scc1) read: loops ensci txinv m wake ilty pen pty write: reset: 0 0 0 0 0 0 0 0 $0015 sci control register 2 (scc2) read: sctie tcie scrie ilie te re rwu sbk write: reset: 0 0 0 0 0 0 0 0 $0016 sci control register 3 (scc3) read: r8 t8 dmare dmate orie neie feie peie write: reset: u u 0 0 0 0 0 0 $0017 sci status register 1 (scs1) read: scte tc scrf idle or nf fe pe write: reset: 1 1 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 3 of 10)
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 43 non-disclosure agreement required $0018 sci status register 2 (scs2) read: bkf rpf write: reset: 0 0 0 0 0 0 0 0 $0019 sci data register (scdr) read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset $001a sci baud rate register (scbr) read: scp1 scp0 scr2 scr1 scr0 write: reset: 0 0 0 0 0 0 0 0 $001b unimplemented $001c unimplemented $001d irq status and control register (iscr) read: irqf2 0 imask2 mode2 irqf1 0 imask1 mode1 write: ack2 ack1 reset: 0 0 0 0 0 0 0 0 $001e flash 3 block protect register (fl3bpr) read: write: bpr3 bpr2 bpr1 bpr0 reset: x x x x 1 1 1 1 $001f flash 1 block protect register (fl1bpr) read: write: f1bpr3 f1bpr2 f1bpr1 f1bpr0 reset: x x x x 1 1 1 1 $0020 timer status and control register (tsc) read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst reset: 0 0 1 0 0 0 0 0 $0021 unimplemented $0022 timer counter register high (tcnth) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 0 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 4 of 10)
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 44 memory map motorola $0023 timer counter register low (tcntl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0024 timer modulo register high (tmodh) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 1 1 1 1 1 1 1 1 $0025 timer modulo register low (tmodl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 $0026 timer channel 0 status and control register (tsc0) read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset: 0 0 0 0 0 0 0 0 $0027 timer channel 0 register high (tch0h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $0028 timer channel 0 register low (tch0l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset $0029 timer channel 1 status and control register (tsc1) read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset: 0 0 0 0 0 0 0 0 $002a timer channel 1 register high (tch1h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $002b timer channel 1 register low (tch1l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset $002c timer channel 2 status and control register (tsc2) read: ch2f ch2ie ms2b ms2a els2b els2a tov2 ch2max write: 0 reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 5 of 10)
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 45 non-disclosure agreement required $002d timer channel 2 register high (tch2h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: unaffected by reset $002e timer channel 2 register low (tch2l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset $002f timer channel 3 status and control register (tsc3) read: ch3f ch3ie 0 ms3a els3b els3a tov3 ch3max write: 0 reset: 0 0 0 0 0 0 0 0 $0030 timer channel 3 register high (tch3h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: unaffected by reset $0031 timer channel 3 register low (tch3l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset $0032 unimplemented $0033 keyboard status and control register (kbscr) read: 0 0 0 0 keyf 0 imaskk modek write: ackk reset: 0 0 0 0 0 0 0 0 $0034 keyboard interrupt enable register (kbier) read: kbie7 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 kbie0 write: reset: 0 0 0 0 0 0 0 0 $0035 unimplemented $0036 alert control register (alcr) read: 0 0 0 0 al3 al2 al1 al0 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 6 of 10)
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 46 memory map motorola $0037 alert data register (aldr) read: spl7 spl6 spl5 spl4 spl3 spl2 spl1 spl0 write: reset: 0 0 0 0 0 0 0 0 $0038 timebase control register (tbxcr) read: tbxif tbxie tbxr1 tbxr0 0 tbxon xtalr1 xtalr0 write: tack reset: 0 0 0 0 0 0 0 0 $0039 unimplemented $003a unimplemented $003b unimplemented $003c unimplemented $003d unimplemented $003e unimplemented $003f mc68hc908pt48 con?guration register (config) read: 0 0 0 ssrec scibdsrc 0 stop copd write: reset: 0 0 0 0 1 0 0 0 $003f mc68hc08pt48 mask option register (mor) read: 0 0 0 ssrec scibdsrc sec stop copd write: reset: 0 0 0 x x x x x $0040 unimplemented $0041 unimplemented addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 7 of 10)
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 47 non-disclosure agreement required $0042 unimplemented $0043 unimplemented $0044 unimplemented $0045 unimplemented $0046 pll control register (pctl) read: pllie pllf pllon bcs pre1 pre0 vpr1 vpr0 write: reset: 0 0 1 0 1 1 1 1 $0047 pll bandwidth control register (pbwc) read: auto lock a cq 0000 coe write: reset: 0 0 0 0 0 0 0 0 $0048 pll multiplier select register high (pmsh) read: 0 0 0 0 mul11 mul10 mul9 mul8 write: reset: 0 0 0 0 0 0 0 0 $0049 pll multiplier select register low (pmsl) read: mul7 mul6 mul5 mul4 mul3 mul2 mul1 mul0 write: reset: 0 0 0 0 0 0 0 0 $004a pll vco range select register (pvrs) read: vrs7 vrs6 vrs5 vrs4 vrs3 vrs2 vrs1 vrs0 write: reset: 0 1 0 0 0 0 0 0 $004b pll reference divider select register (prds) read: 0 0 0 0 rds3 rds2 rds1 rds0 write: reset: 0 0 0 0 0 0 0 1 $004c analog-to-digital status and control register (adscr) read: coco/ idmas aien adco adch4 adch3 adch2 adch1 adch0 write: reset: 0 0 0 1 1 1 1 1 addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 8 of 10)
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 48 memory map motorola $004d analog-to-digital data register (adr) read: ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 write: reset: 0 0 0 0 0 0 0 0 $004e analog-to-digital clock register (adclkr) read: adiv2 adiv1 adiv0 adiclk 0000 write: reset: 0 0 0 0 0 0 0 0 $004f mc68hc908pt48 16 k-flash 2 block protect register (fl2bpr) read: write: f2bpr3 f2bpr2 f2bpr1 f2bpr0 reset: x x x x 1 1 1 1 $fe00 sim break status register (sbsr) read: rr r r r r sbsw r write: note 1 reset: 0 note 1. writing a logic 0 clears sbsw. $fe01 sim reset status register (srsr) read: por pin cop ilop ilad 0 lvi 0 write: reset: 1 0 0 0 0 0 0 0 $fe02 reserved $fe03 sim break flag control register (sbfcr) read: bcfe r r r r r r r write: reset: 0 $fe04 reserved $fe05 reserved $fe06 reserved addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 9 of 10)
memory map memory map mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 49 non-disclosure agreement required $fe07 reserved $fe08 flash 3 control register (fl3cr) read: f3div1 f3div0 f3blk1 f3blk0 hven marg erase pgm write: reset: 0 0 0 0 0 0 0 0 $fe09 reserved $fe0a flash2 control register (fl2cr) read: f2div1 f2div0 f2blk1 f2blk0 hven marg erase pgm write: reset: 0 0 0 0 0 0 0 0 $fe0b reserved $fe0c flash 1 control register (fl1cr) read: f1div1 f1div0 f1blk1 f1blk0 hven marg erase pgm write: reset: 0 0 0 0 0 0 0 0 $fe0d break address register high (brkh) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $fe0e break address register low (brkl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $fe0f break status/control register (brkscr) read: brke brka write: reset: 0 0 0 0 0 0 0 0 $ffff cop control register (copctl) read: low byte of reset vector write: clear cop counter reset: unaffected by reset addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented u = undetermined x = indeterminate figure 2-3. control, status, and data registers (sheet 10 of 10)
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 50 memory map motorola figure 2-4. vector addresses in flash/rom swi vector (high) $ffe0 $ffe1 $ffe2 $ffe3 $ffe4 $ffe5 $ffe6 $ffe7 $ffe8 $ffe9 $ffea $ffeb $ffec $ffed $ffee $ffef tim channel 0 vector (high) tim channel 0 vector (low) external irq2 vector (high) $fff0 $fff1 $fff2 $fff3 $fff4 $fff5 $fff6 $fff7 $fff9 $fffa $fffb $fffc $fffd $fffe $ffff $fff8 pll vector (high) pll vector (low) spi transmit vector (high) spi transmit vector (low) sci transmit vector (high) sci transmit vector (low) sci receive vector (high) sci receive vector (low) sci error vector (high) sci error vector (low) timebase vector (high) timebase vector(low) tim overflowvector (high) tim overflow vector (low) tim channel 3 vector (high) tim channel 3 vector (low) tim channel 2 vector (high) tim channel 2 vector (low) tim channel 1 vector (low) tim channel 1 vector (high) external irq2 vector (low) irq1 vector (high) irq1 vector (low) swi vector (low) reset vector (low) reset vector (high) spi receive vector (low) spi receive vector (high) lowest priority highest priority $ffde $ffdf $ffdc $ffdd a/d vector (high) a/d vector (low) keyboard vector (high) keyboard vector (low)
memory map user flash/rom mc68hc(9)08pt48 rev. 2.0 advance information motorola memory map 51 non-disclosure agreement required 2.6 user flash/rom the mcu has 48 kbytes of flash (mc68hc908pt48) or mask programmable rom (mc68hc08pt48). these addresses are user flash/rom locations: ? $4000C$fdff ? $ffdcC$ffff; reserved for user-defined interrupt and reset vectors) 2.7 flash prom the mcu has 2 kbytes of flash separate from the main array. these addresses are flash locations: ? $1800C$1fff 2.8 monitor rom the 240 bytes at addresses $fe10C$feff are reserved rom addresses that contain the instructions for the monitor functions. for more information, see section 18. monitor rom (mon) .
non-disclosure agreement required memory map advance information mc68hc(9)08pt48 rev. 2.0 52 memory map motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 53 non-disclosure agreement required advance information mc68hc(9)08pt48 section 3. central processor unit (cpu) 3.1 contents 3.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 3.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 3.4 cpu registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 3.4.1 accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3.4.2 index register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 3.4.3 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56 3.4.4 program counter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 3.4.5 condition code register . . . . . . . . . . . . . . . . . . . . . . . . . . .58 3.5 arithmetic/logic unit (alu) . . . . . . . . . . . . . . . . . . . . . . . . . . .60 3.6 cpu during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .60 3.7 instruction set summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 3.8 opcode map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 3.2 introduction this section describes the central processor unit (cpu8, version a). the m68hc08 cpu is an enhanced and fully object-code-compatible version of the m68hc05 cpu. the cpu08 reference manual (motorola document order number cpu08rm/ad) contains a description of the cpu instruction set, addressing modes, and architecture.
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 54 central processor unit (cpu) motorola 3.3 features features of the cpu include: ? full upward, object-code compatibility with m68hc05 family ? 16-bit stack pointer with stack manipulation instructions ? 16-bit index register with x-register manipulation instructions ? 64-kbyte program/data memory space ? 16 addressing modes ? memory-to-memory data moves without using accumulator ? fast 8-bit by 8-bit multiply and 16-bit by 8-bit divide instructions ? enhanced binary-coded decimal (bcd) data handling ? modular architecture with expandable internal bus definition for extension of addressing range beyond 64 kbytes ? low-power stop and wait modes 3.4 cpu registers figure 3-1 shows the five cpu registers. cpu registers are not part of the memory map. figure 3-1. cpu registers accumulator (a) index register (h:x) stack pointer (sp) program counter (pc) condition code register (ccr) carry/borrow flag zero flag negative flag interrupt mask half-carry flag twos complement overflow flag v11hinzc h x 0 0 0 0 7 15 15 15 70
central processor unit (cpu) cpu registers mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 55 non-disclosure agreement required 3.4.1 accumulator the accumulator (a) is a general-purpose 8-bit register. the cpu uses the accumulator to hold operands and the results of arithmetic/logic operations. 3.4.2 index register the 16-bit index register allows indexed addressing of a 64-kbyte memory space. h is the upper byte of the index register, and x is the lower byte. h:x is the concatenated 16-bit index register. in the indexed addressing modes, the cpu uses the contents of the index register to determine the conditional address of the operand. the index register can serve also as a temporary data storage location. bit 7 6 5 4 3 2 1 bit 0 read: write: reset: unaffected by reset figure 3-2. accumulator (a) bit 151413121110987654321 bit 0 read: write: reset: 00000000 xxxxxxxx x = indeterminate figure 3-3. index register (h:x)
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 56 central processor unit (cpu) motorola 3.4.3 stack pointer the stack pointer (sp) is a 16-bit register that contains the address of the next location on the stack. during a reset, the stack pointer is preset to $00ff. the reset stack pointer (rsp) instruction sets the least significant byte (lsb) to $ff and does not affect the most significant byte (msb). the stack pointer decrements as data is pushed onto the stack and increments as data is pulled from the stack. in the stack pointer 8-bit offset and 16-bit offset addressing modes, the stack pointer can function as an index register to access data on the stack. the cpu uses the contents of the stack pointer to determine the conditional address of the operand. note: the location of the stack is arbitrary and may be relocated anywhere in ram. moving the sp out of page zero ($0000 to $00ff) frees direct address (page zero) space. for correct operation, the stack pointer must point to ram locations only. bit 151413121110987654321 bit 0 read: write: reset: 0000000011111111 figure 3-4. stack pointer (sp)
central processor unit (cpu) cpu registers mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 57 non-disclosure agreement required 3.4.4 program counter the program counter (pc) is a 16-bit register that contains the address of the next instruction or operand to be fetched. normally, the program counter automatically increments to the next sequential memory location every time an instruction or operand is fetched. jump, branch, and interrupt operations load the program counter with an address other than that of the next sequential location. during reset, the program counter is loaded with the reset vector address located at $fffe and $ffff. the vector address is the address of the first instruction to be executed after exiting the reset state. bit 151413121110987654321 bit 0 read: write: reset: loaded with vector from $fffe and $ffff figure 3-5. program counter (pc)
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 58 central processor unit (cpu) motorola 3.4.5 condition code register the 8-bit condition code register (ccr) contains the interrupt mask and five flags that indicate the results of the instruction just executed. bits 6 and 5 are set permanently to logic 1. the following paragraphs describe the functions of the condition code register. v overflow flag the cpu sets the overflow flag when a twos complement overflow occurs. the signed branch instructions bgt, bge, ble, and blt use the overflow flag. 1 = overflow 0 = no overflow h half-carry flag the cpu sets the half-carry flag when a carry occurs between accumulator bits 3 and 4 during an adc (add with carry) or add (add without carry) operation. the half-carry flag is required for binary- coded decimal (bcd) arithmetic operations. the daa (decimal adjust a) instruction uses the states of the h and c flags to determine the appropriate correction factor. 1 = carry between bits 3 and 4 0 = no carry between bits 3 and 4 bit 7 6 5 4 3 2 1 bit 0 read: v11h i nzc write: reset: x 1 1 x 1 x x x x = indeterminate figure 3-6. condition code register (ccr)
central processor unit (cpu) cpu registers mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 59 non-disclosure agreement required i interrupt mask when the interrupt mask is set, all maskable cpu interrupts are disabled. cpu interrupts are enabled when the interrupt mask is cleared. when a cpu interrupt occurs, the interrupt mask is set automatically after the cpu registers are saved on the stack, but before the interrupt vector is fetched. 1 = interrupts disabled 0 = interrupts enabled note: to maintain m6805 compatibility, the upper byte of the index register (h) is not stacked automatically. if the interrupt service routine modifies h, then the user must stack and unstack h using the pshh and pulh instructions. after the i bit is cleared, the highest-priority interrupt request is serviced first. a return-from-interrupt (rti) instruction pulls the cpu registers from the stack and restores the interrupt mask from the stack. after any reset, the interrupt mask is set and can be cleared only by the clear interrupt mask software instruction (cli). n negative flag the cpu sets the negative flag when an arithmetic operation, logic operation, or data manipulation produces a negative result, setting bit 7 of the result. 1 = negative result 0 = non-negative result z zero flag the cpu sets the zero flag when an arithmetic operation, logic operation, or data manipulation produces a result of $00. 1 = zero result 0 = non-zero result
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 60 central processor unit (cpu) motorola c carry/borrow flag the cpu sets the carry/borrow flag when an addition operation produces a carry out of bit 7 of the accumulator or when a subtraction operation requires a borrow. some instructions such as bit test and branch, shift, and rotate also clear or set the carry/borrow flag. 1 = carry out of bit 7 0 = no carry out of bit 7 3.5 arithmetic/logic unit (alu) the alu performs the arithmetic and logic operations defined by the instruction set. refer to the cpu08 reference manual (motorola document order number cpu08rm/ad) for a description of the instructions and addressing modes and more detail about cpu architecture. 3.6 cpu during break interrupts if the break module is enabled, a break interrupt causes the cpu to execute the software interrupt instruction (swi) at the completion of the current cpu instruction. (see section 19. break module .) the program counter vectors to $fffcC$fffd ($fefcC$fefd in monitor mode). a return-from-interrupt instruction (rti) in the break routine ends the break interrupt and returns the mcu to normal operation if the break interrupt has been deasserted.
central processor unit (cpu) instruction set summary mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 61 non-disclosure agreement required 3.7 instruction set summary table 3-1. instruction set summary source form operation description effect on ccr address mode opcode operand cycles vh i nzc adc # opr adc opr adc opr adc opr ,x adc opr ,x adc ,x adc opr ,sp adc opr ,sp add with carry a ? (a) + (m) + (c) C imm dir ext ix2 ix1 ix sp1 sp2 a9 b9 c9 d9 e9 f9 9ee9 9ed9 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 add # opr add opr add opr add opr ,x add opr ,x add ,x add opr ,sp add opr ,sp add without carry a ? (a) + (m) C imm dir ext ix2 ix1 ix sp1 sp2 ab bb cb db eb fb 9eeb 9edb ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ais # opr add immediate value (signed) to sp sp ? (sp) + (16 ? m) C C C C C C imm a7 ii 2 aix # opr add immediate value (signed) to h:x h:x ? (h:x) + (16 ? m) C C C C C C imm af ii 2 and # opr and opr and opr and opr ,x and opr ,x and ,x and opr ,sp and opr ,sp logical and a ? (a) & (m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 a4 b4 c4 d4 e4 f4 9ee4 9ed4 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 asl opr asla aslx asl opr ,x asl ,x asl opr ,sp arithmetic shift left (same as lsl) CC dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 asr opr asra asrx asr opr ,x asr opr ,x asr opr ,sp arithmetic shift right CC dir inh inh ix1 ix sp1 37 47 57 67 77 9e67 dd ff ff 4 1 1 4 3 5 bcc rel branch if carry bit clear pc ? (pc) + 2 + rel ? (c) = 0 C C C C C C rel 24 rr 3 bclr n , opr clear bit n in m mn ? 0 CCCCCC dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 11 13 15 17 19 1b 1d 1f dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bcs rel branch if carry bit set (same as blo) pc ? (pc) + 2 + rel ? (c) = 1 C C C C C C rel 25 rr 3 beq rel branch if equal pc ? (pc) + 2 + rel ? (z) = 1 C C C C C C rel 27 rr 3 bge opr branch if greater than or equal to (signed operands) pc ? (pc) + 2 + rel ? (n ? v ) = 0 C C C C C C rel 90 rr 3 c b0 b7 0 b0 b7 c
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 62 central processor unit (cpu) motorola bgt opr branch if greater than (signed operands) pc ? (pc) + 2 + rel ? (z) | (n ? v ) = 0 C C C C C C rel 92 rr 3 bhcc rel branch if half carry bit clear pc ? (pc) + 2 + rel ? (h) = 0 C C C C C C rel 28 rr 3 bhcs rel branch if half carry bit set pc ? (pc) + 2 + rel ? (h) = 1 C C C C C C rel 29 rr 3 bhi rel branch if higher pc ? (pc) + 2 + rel ? (c) | (z) = 0 C C C C C C rel 22 rr 3 bhs rel branch if higher or same (same as bcc) pc ? (pc) + 2 + rel ? (c) = 0 C C C C C C rel 24 rr 3 bih rel branch if irq pin high pc ? (pc) + 2 + rel ? irq = 1 C C C C C C rel 2f rr 3 bil rel branch if irq pin low pc ? (pc) + 2 + rel ? irq = 0 C C C C C C rel 2e rr 3 bit # opr bit opr bit opr bit opr ,x bit opr ,x bit ,x bit opr ,sp bit opr ,sp bit test (a) & (m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 a5 b5 c5 d5 e5 f5 9ee5 9ed5 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ble opr branch if less than or equal to (signed operands) pc ? (pc) + 2 + rel ? (z) | (n ? v ) = 1 C C C C C C rel 93 rr 3 blo rel branch if lower (same as bcs) pc ? (pc) + 2 + rel ? (c) = 1 C C C C C C rel 25 rr 3 bls rel branch if lower or same pc ? (pc) + 2 + rel ? (c) | (z) = 1 C C C C C C rel 23 rr 3 blt opr branch if less than (signed operands) pc ? (pc) + 2 + rel ? (n ? v ) = 1 C C C C C C rel 91 rr 3 bmc rel branch if interrupt mask clear pc ? (pc) + 2 + rel ? (i) = 0 C C C C C C rel 2c rr 3 bmi rel branch if minus pc ? (pc) + 2 + rel ? (n) = 1 C C C C C C rel 2b rr 3 bms rel branch if interrupt mask set pc ? (pc) + 2 + rel ? (i) = 1 C C C C C C rel 2d rr 3 bne rel branch if not equal pc ? (pc) + 2 + rel ? (z) = 0 C C C C C C rel 26 rr 3 bpl rel branch if plus pc ? (pc) + 2 + rel ? (n) = 0 C C C C C C rel 2a rr 3 bra rel branch always pc ? (pc) + 2 + rel C C C C C C rel 20 rr 3 brclr n , opr , rel branch if bit n in m clear pc ? (pc) + 3 + rel ? (mn) = 0 C C C C C dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 01 03 05 07 09 0b 0d 0f dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 brn rel branch never pc ? (pc) + 2 C C C C C C rel 21 rr 3 brset n , opr , rel branch if bit n in m set pc ? (pc) + 3 + rel ? (mn) = 1 C C C C C dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 00 02 04 06 08 0a 0c 0e dd rr dd rr dd rr dd rr dd rr dd rr dd rr dd rr 5 5 5 5 5 5 5 5 table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) instruction set summary mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 63 non-disclosure agreement required bset n , opr set bit n in m mn ? 1 CCCCCC dir (b0) dir (b1) dir (b2) dir (b3) dir (b4) dir (b5) dir (b6) dir (b7) 10 12 14 16 18 1a 1c 1e dd dd dd dd dd dd dd dd 4 4 4 4 4 4 4 4 bsr rel branch to subroutine pc ? (pc) + 2; push (pcl) sp ? (sp) C 1; push (pch) sp ? (sp) C 1 pc ? (pc) + rel C C C C C C rel ad rr 4 cbeq opr,rel cbeqa # opr,rel cbeqx # opr,rel cbeq opr, x+ ,rel cbeq x+ ,rel cbeq opr, sp ,rel compare and branch if equal pc ? (pc) + 3 + rel ? (a) C (m) = $00 pc ? (pc) + 3 + rel ? (a) C (m) = $00 pc ? (pc) + 3 + rel ? (x) C (m) = $00 pc ? (pc) + 3 + rel ? (a) C (m) = $00 pc ? (pc) + 2 + rel ? (a) C (m) = $00 pc ? (pc) + 4 + rel ? (a) C (m) = $00 CCCCCC dir imm imm ix1+ ix+ sp1 31 41 51 61 71 9e61 dd rr ii rr ii rr ff rr rr ff rr 5 4 4 5 4 6 clc clear carry bit c ? 0 C C C C C 0 inh 98 1 cli clear interrupt mask i ? 0 C C 0 C C C inh 9a 2 clr opr clra clrx clrh clr opr ,x clr ,x clr opr ,sp clear m ? $00 a ? $00 x ? $00 h ? $00 m ? $00 m ? $00 m ? $00 0CC01C dir inh inh inh ix1 ix sp1 3f 4f 5f 8c 6f 7f 9e6f dd ff ff 3 1 1 1 3 2 4 cmp # opr cmp opr cmp opr cmp opr ,x cmp opr ,x cmp ,x cmp opr ,sp cmp opr ,sp compare a with m (a) C (m) CC imm dir ext ix2 ix1 ix sp1 sp2 a1 b1 c1 d1 e1 f1 9ee1 9ed1 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 com opr coma comx com opr ,x com ,x com opr ,sp complement (ones complement) m ? ( m) = $ff C (m) a ? ( a) = $ff C (m) x ? ( x) = $ff C (m) m ? ( m) = $ff C (m) m ? ( m) = $ff C (m) m ? ( m) = $ff C (m) 0CC 1 dir inh inh ix1 ix sp1 33 43 53 63 73 9e63 dd ff ff 4 1 1 4 3 5 cphx # opr cphx opr compare h:x with m (h:x) C (m:m + 1) CC imm dir 65 75 ii ii+1 dd 3 4 cpx # opr cpx opr cpx opr cpx ,x cpx opr ,x cpx opr ,x cpx opr ,sp cpx opr ,sp compare x with m (x) C (m) CC imm dir ext ix2 ix1 ix sp1 sp2 a3 b3 c3 d3 e3 f3 9ee3 9ed3 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 daa decimal adjust a (a) 10 uCC inh 72 2 table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 64 central processor unit (cpu) motorola dbnz opr,rel dbnza rel dbnzx rel dbnz opr, x ,rel dbnz x ,rel dbnz opr, sp ,rel decrement and branch if not zero a ? (a) C 1 or m ? (m) C 1 or x ? (x)C1 pc ? (pc) + 3 + rel ? (result) 1 0 pc ? (pc) + 2 + rel ? (result) 1 0 pc ? (pc) + 2 + rel ? (result) 1 0 pc ? (pc) + 3 + rel ? (result) 1 0 pc ? (pc) + 2 + rel ? (result) 1 0 pc ? (pc) + 4 + rel ? (result) 1 0 CCCCCC dir inh inh ix1 ix sp1 3b 4b 5b 6b 7b 9e6b dd rr rr rr ff rr rr ff rr 5 3 3 5 4 6 dec opr deca decx dec opr ,x dec ,x dec opr ,sp decrement m ? (m) C 1 a ? (a) C 1 x ? (x) C 1 m ? (m) C 1 m ? (m) C 1 m ? (m) C 1 CC C dir inh inh ix1 ix sp1 3a 4a 5a 6a 7a 9e6a dd ff ff 4 1 1 4 3 5 div divide a ? (h:a)/(x) h ? remainder CCCC inh 52 7 eor # opr eor opr eor opr eor opr ,x eor opr ,x eor ,x eor opr ,sp eor opr ,sp exclusive or m with a a ? (a ? m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 a8 b8 c8 d8 e8 f8 9ee8 9ed8 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 inc opr inca incx inc opr ,x inc ,x inc opr ,sp increment m ? (m) + 1 a ? (a) + 1 x ? (x) + 1 m ? (m) + 1 m ? (m) + 1 m ? (m) + 1 CC C dir inh inh ix1 ix sp1 3c 4c 5c 6c 7c 9e6c dd ff ff 4 1 1 4 3 5 jmp opr jmp opr jmp opr ,x jmp opr ,x jmp ,x jump pc ? jump address C C C C C C dir ext ix2 ix1 ix bc cc dc ec fc dd hh ll ee ff ff 2 3 4 3 2 jsr opr jsr opr jsr opr ,x jsr opr ,x jsr ,x jump to subroutine pc ? (pc) + n ( n = 1, 2, or 3) push (pcl); sp ? (sp) C 1 push (pch); sp ? (sp) C 1 pc ? unconditional address CCCCCC dir ext ix2 ix1 ix bd cd dd ed fd dd hh ll ee ff ff 4 5 6 5 4 lda # opr lda opr lda opr lda opr ,x lda opr ,x lda ,x lda opr ,sp lda opr ,sp load a from m a ? (m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 a6 b6 c6 d6 e6 f6 9ee6 9ed6 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 ldhx # opr ldhx opr load h:x from m h:x ? ( m:m + 1 ) 0CC C imm dir 45 55 ii jj dd 3 4 ldx # opr ldx opr ldx opr ldx opr ,x ldx opr ,x ldx ,x ldx opr ,sp ldx opr ,sp load x from m x ? (m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 ae be ce de ee fe 9eee 9ede ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) instruction set summary mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 65 non-disclosure agreement required lsl opr lsla lslx lsl opr ,x lsl ,x lsl opr ,sp logical shift left (same as asl) CC dir inh inh ix1 ix sp1 38 48 58 68 78 9e68 dd ff ff 4 1 1 4 3 5 lsr opr lsra lsr x lsr opr ,x lsr ,x lsr opr ,sp logical shift right CC0 dir inh inh ix1 ix sp1 34 44 54 64 74 9e64 dd ff ff 4 1 1 4 3 5 mov opr,opr mov opr, x+ mov # opr,opr mov x+ ,opr move (m) destination ? (m) source h:x ? (h:x) + 1 (ix+d, dix+) 0CC C dd dix+ imd ix+d 4e 5e 6e 7e dd dd dd ii dd dd 5 4 4 4 mul unsigned multiply x:a ? (x) (a) C 0 C C C 0 inh 42 5 neg opr nega negx neg opr ,x neg ,x neg opr ,sp negate (twos complement) m ? C(m) = $00 C (m) a ? C(a) = $00 C (a) x ? C(x) = $00 C (x) m ? C(m) = $00 C (m) m ? C(m) = $00 C (m) CC dir inh inh ix1 ix sp1 30 40 50 60 70 9e60 dd ff ff 4 1 1 4 3 5 nop no operation none C C C C C C inh 9d 1 nsa nibble swap a a ? (a[3:0]:a[7:4]) C C C C C C inh 62 3 ora # opr ora opr ora opr ora opr ,x ora opr ,x ora ,x ora opr ,sp ora opr ,sp inclusive or a and m a ? (a) | (m) 0 C C C imm dir ext ix2 ix1 ix sp1 sp2 aa ba ca da ea fa 9eea 9eda ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 psha push a onto stack push (a); sp ? (sp ) C 1 C C C C C C inh 87 2 pshh push h onto stack push (h) ; sp ? (sp ) C 1 CCCCCCinh 8b 2 pshx push x onto stack push (x) ; sp ? (sp ) C 1 CCCCCCinh 89 2 pula pull a from stack sp ? (sp + 1); pull ( a ) CCCCCCinh 86 2 pulh pull h from stack sp ? (sp + 1); pull ( h ) CCCCCCinh 8a 2 pulx pull x from stack sp ? (sp + 1); pull ( x ) CCCCCCinh 88 2 rol opr rola rolx rol opr ,x rol ,x rol opr ,sp rotate left through carry CC dir inh inh ix1 ix sp1 39 49 59 69 79 9e69 dd ff ff 4 1 1 4 3 5 ror opr rora rorx ror opr ,x ror ,x ror opr ,sp rotate right through carry CC dir inh inh ix1 ix sp1 36 46 56 66 76 9e66 dd ff ff 4 1 1 4 3 5 table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc c b0 b7 0 b0 b7 c 0 c b0 b7 b0 b7 c
non-disclosure agreement required central processor unit (cpu) advance information mc68hc(9)08pt48 rev. 2.0 66 central processor unit (cpu) motorola rsp reset stack pointer sp ? $ff C C C C C C inh 9c 1 rti return from interrupt sp ? (sp) + 1; pull (ccr) sp ? (sp) + 1; pull (a) sp ? (sp) + 1; pull (x) sp ? (sp) + 1; pull (pch) sp ? (sp) + 1; pull (pcl) inh 80 7 rts return from subroutine sp ? sp + 1 ; pull ( pch) sp ? sp + 1; pull (pcl) CCCCCCinh 81 4 sbc # opr sbc opr sbc opr sbc opr ,x sbc opr ,x sbc ,x sbc opr ,sp sbc opr ,sp subtract with carry a ? (a) C (m) C (c) CC imm dir ext ix2 ix1 ix sp1 sp2 a2 b2 c2 d2 e2 f2 9ee2 9ed2 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 sec set carry bit c ? 1 C C C C C 1 inh 99 1 sei set interrupt mask i ? 1 C C 1 C C C inh 9b 2 sta opr sta opr sta opr ,x sta opr ,x sta ,x sta opr ,sp sta opr ,sp store a in m m ? (a) 0 C C C dir ext ix2 ix1 ix sp1 sp2 b7 c7 d7 e7 f7 9ee7 9ed7 dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sthx opr store h:x in m (m:m + 1) ? (h:x) 0 C C C dir 35 dd 4 stop enable irq pin; stop oscillator i ? 0; stop oscillator C C 0 C C C inh 8e 1 stx opr stx opr stx opr ,x stx opr ,x stx ,x stx opr ,sp stx opr ,sp store x in m m ? (x) 0 C C C dir ext ix2 ix1 ix sp1 sp2 bf cf df ef ff 9eef 9edf dd hh ll ee ff ff ff ee ff 3 4 4 3 2 4 5 sub # opr sub opr sub opr sub opr ,x sub opr ,x sub ,x sub opr ,sp sub opr ,sp subtract a ? (a) C (m) CC imm dir ext ix2 ix1 ix sp1 sp2 a0 b0 c0 d0 e0 f0 9ee0 9ed0 ii dd hh ll ee ff ff ff ee ff 2 3 4 4 3 2 4 5 swi software interrupt pc ? (pc) + 1; push (pcl) sp ? (sp) C 1; push (pch) sp ? (sp) C 1; push (x) sp ? (sp) C 1; push (a) sp ? (sp) C 1; push (ccr) sp ? (sp) C 1; i ? 1 pch ? interrupt vector high byte pcl ? interrupt vector low byte CC1CCCinh 83 9 tap transfer a to ccr ccr ? (a) inh 84 2 tax transfer a to x x ? (a) C C C C C C inh 97 1 tpa transfer ccr to a a ? (ccr) C C C C C C inh 85 1 table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
central processor unit (cpu) opcode map mc68hc(9)08pt48 rev. 2.0 advance information motorola central processor unit (cpu) 67 non-disclosure agreement required 3.8 opcode map see table 3-2 . tst opr tsta tstx tst opr ,x tst ,x tst opr ,sp test for negative or zero (a) C $00 or (x) C $00 or (m) C $00 0 C C C dir inh inh ix1 ix sp1 3d 4d 5d 6d 7d 9e6d dd ff ff 3 1 1 3 2 4 tsx transfer sp to h:x h:x ? (sp) + 1 C C C C C C inh 95 2 txa transfer x to a a ? (x) C C C C C C inh 9f 1 txs transfer h:x to sp (sp) ? (h:x) C 1 C C C C C C inh 94 2 a accumulator n any bit c carry/borrow bit opr operand (one or two bytes) ccr condition code register pc program counter dd direct address of operand pch program counter high byte dd rr direct address of operand and relative offset of branch instruction pcl program counter low byte dd direct to direct addressing mode rel relative addressing mode dir direct addressing mode rel relative program counter offset byte dix+ direct to indexed with post increment addressing mode rr relative program counter offset byte ee ff high and low bytes of offset in indexed, 16-bit offset addressing sp1 stack pointer, 8-bit offset addressing mode ext extended addressing mode sp2 stack pointer 16-bit offset addressing mode ff offset byte in indexed, 8-bit offset addressing sp stack pointer h half-carry bit u unde?ned h index register high byte v over?ow bit hh ll high and low bytes of operand address in extended addressing x index register low byte i interrupt mask z zero bit ii immediate operand byte & logical and imd immediate source to direct destination addressing mode | logical or imm immediate addressing mode ? logical exclusive or inh inherent addressing mode ( ) contents of ix indexed, no offset addressing mode C( ) negation (twos complement) ix+ indexed, no offset, post increment addressing mode # immediate value ix+d indexed with post increment to direct addressing mode ? sign extend ix1 indexed, 8-bit offset addressing mode ? loaded with ix1+ indexed, 8-bit offset, post increment addressing mode ? if ix2 indexed, 16-bit offset addressing mode : concatenated with m memory location set or cleared n negative bit not affected table 3-1. instruction set summary (continued) source form operation description effect on ccr address mode opcode operand cycles vh i nzc
non-disclosure agreement required advance information mc68hc(9)08pt48 rev. 2.0 68 central processor unit (cpu) motorola central processor unit (cpu) table 3-2. opcode map bit manipulation branch read-modify-write control register/memory dir dir rel dir inh inh ix1 sp1 ix inh inh imm dir ext ix2 sp2 ix1 sp1 ix 0 1234569e6789 abcd9ede9eef 0 5 brset0 3 dir 4 bset0 2 dir 3 bra 2 rel 4 neg 2 dir 1 nega 1 inh 1 negx 1 inh 4 neg 2 ix1 5 neg 3 sp1 3 neg 1ix 7 rti 1 inh 3 bge 2 rel 2 sub 2 imm 3 sub 2 dir 4 sub 3 ext 4 sub 3 ix2 5 sub 4 sp2 3 sub 2 ix1 4 sub 3 sp1 2 sub 1ix 1 5 brclr0 3 dir 4 bclr0 2 dir 3 brn 2 rel 5 cbeq 3 dir 4 cbeqa 3 imm 4 cbeqx 3 imm 5 cbeq 3 ix1+ 6 cbeq 4 sp1 4 cbeq 2 ix+ 4 rts 1 inh 3 blt 2 rel 2 cmp 2 imm 3 cmp 2 dir 4 cmp 3 ext 4 cmp 3 ix2 5 cmp 4 sp2 3 cmp 2 ix1 4 cmp 3 sp1 2 cmp 1ix 2 5 brset1 3 dir 4 bset1 2 dir 3 bhi 2 rel 5 mul 1 inh 7 div 1 inh 3 nsa 1 inh 2 daa 1 inh 3 bgt 2 rel 2 sbc 2 imm 3 sbc 2 dir 4 sbc 3 ext 4 sbc 3 ix2 5 sbc 4 sp2 3 sbc 2 ix1 4 sbc 3 sp1 2 sbc 1ix 3 5 brclr1 3 dir 4 bclr1 2 dir 3 bls 2 rel 4 com 2 dir 1 coma 1 inh 1 comx 1 inh 4 com 2 ix1 5 com 3 sp1 3 com 1ix 9 swi 1 inh 3 ble 2 rel 2 cpx 2 imm 3 cpx 2 dir 4 cpx 3 ext 4 cpx 3 ix2 5 cpx 4 sp2 3 cpx 2 ix1 4 cpx 3 sp1 2 cpx 1ix 4 5 brset2 3 dir 4 bset2 2 dir 3 bcc 2 rel 4 lsr 2 dir 1 lsra 1 inh 1 lsrx 1 inh 4 lsr 2 ix1 5 lsr 3 sp1 3 lsr 1ix 2 ta p 1 inh 2 txs 1 inh 2 and 2 imm 3 and 2 dir 4 and 3 ext 4 and 3 ix2 5 and 4 sp2 3 and 2 ix1 4 and 3 sp1 2 and 1ix 5 5 brclr2 3 dir 4 bclr2 2 dir 3 bcs 2 rel 4 sthx 2 dir 3 ldhx 3 imm 4 ldhx 2 dir 3 cphx 3 imm 4 cphx 2 dir 1 tpa 1 inh 2 tsx 1 inh 2 bit 2 imm 3 bit 2 dir 4 bit 3 ext 4 bit 3 ix2 5 bit 4 sp2 3 bit 2 ix1 4 bit 3 sp1 2 bit 1ix 6 5 brset3 3 dir 4 bset3 2 dir 3 bne 2 rel 4 ror 2 dir 1 rora 1 inh 1 rorx 1 inh 4 ror 2 ix1 5 ror 3 sp1 3 ror 1ix 2 pula 1 inh 2 lda 2 imm 3 lda 2 dir 4 lda 3 ext 4 lda 3 ix2 5 lda 4 sp2 3 lda 2 ix1 4 lda 3 sp1 2 lda 1ix 7 5 brclr3 3 dir 4 bclr3 2 dir 3 beq 2 rel 4 asr 2 dir 1 asra 1 inh 1 asrx 1 inh 4 asr 2 ix1 5 asr 3 sp1 3 asr 1ix 2 psha 1 inh 1 ta x 1 inh 2 ais 2 imm 3 sta 2 dir 4 sta 3 ext 4 sta 3 ix2 5 sta 4 sp2 3 sta 2 ix1 4 sta 3 sp1 2 sta 1ix 8 5 brset4 3 dir 4 bset4 2 dir 3 bhcc 2 rel 4 lsl 2 dir 1 lsla 1 inh 1 lslx 1 inh 4 lsl 2 ix1 5 lsl 3 sp1 3 lsl 1ix 2 pulx 1 inh 1 clc 1 inh 2 eor 2 imm 3 eor 2 dir 4 eor 3 ext 4 eor 3 ix2 5 eor 4 sp2 3 eor 2 ix1 4 eor 3 sp1 2 eor 1ix 9 5 brclr4 3 dir 4 bclr4 2 dir 3 bhcs 2 rel 4 rol 2 dir 1 rola 1 inh 1 rolx 1 inh 4 rol 2 ix1 5 rol 3 sp1 3 rol 1ix 2 pshx 1 inh 1 sec 1 inh 2 adc 2 imm 3 adc 2 dir 4 adc 3 ext 4 adc 3 ix2 5 adc 4 sp2 3 adc 2 ix1 4 adc 3 sp1 2 adc 1ix a 5 brset5 3 dir 4 bset5 2 dir 3 bpl 2 rel 4 dec 2 dir 1 deca 1 inh 1 decx 1 inh 4 dec 2 ix1 5 dec 3 sp1 3 dec 1ix 2 pulh 1 inh 2 cli 1 inh 2 ora 2 imm 3 ora 2 dir 4 ora 3 ext 4 ora 3 ix2 5 ora 4 sp2 3 ora 2 ix1 4 ora 3 sp1 2 ora 1ix b 5 brclr5 3 dir 4 bclr5 2 dir 3 bmi 2 rel 5 dbnz 3 dir 3 dbnza 2 inh 3 dbnzx 2 inh 5 dbnz 3 ix1 6 dbnz 4 sp1 4 dbnz 2ix 2 pshh 1 inh 2 sei 1 inh 2 add 2 imm 3 add 2 dir 4 add 3 ext 4 add 3 ix2 5 add 4 sp2 3 add 2 ix1 4 add 3 sp1 2 add 1ix c 5 brset6 3 dir 4 bset6 2 dir 3 bmc 2 rel 4 inc 2 dir 1 inca 1 inh 1 incx 1 inh 4 inc 2 ix1 5 inc 3 sp1 3 inc 1ix 1 clrh 1 inh 1 rsp 1 inh 2 jmp 2 dir 3 jmp 3 ext 4 jmp 3 ix2 3 jmp 2 ix1 2 jmp 1ix d 5 brclr6 3 dir 4 bclr6 2 dir 3 bms 2 rel 3 tst 2 dir 1 tsta 1 inh 1 tstx 1 inh 3 tst 2 ix1 4 tst 3 sp1 2 tst 1ix 1 nop 1 inh 4 bsr 2 rel 4 jsr 2 dir 5 jsr 3 ext 6 jsr 3 ix2 5 jsr 2 ix1 4 jsr 1ix e 5 brset7 3 dir 4 bset7 2 dir 3 bil 2 rel 5 mov 3dd 4 mov 2 dix+ 4 mov 3 imd 4 mov 2 ix+d 1 stop 1 inh * 2 ldx 2 imm 3 ldx 2 dir 4 ldx 3 ext 4 ldx 3 ix2 5 ldx 4 sp2 3 ldx 2 ix1 4 ldx 3 sp1 2 ldx 1ix f 5 brclr7 3 dir 4 bclr7 2 dir 3 bih 2 rel 3 clr 2 dir 1 clra 1 inh 1 clrx 1 inh 3 clr 2 ix1 4 clr 3 sp1 2 clr 1ix 1 wait 1 inh 1 txa 1 inh 2 aix 2 imm 3 stx 2 dir 4 stx 3 ext 4 stx 3 ix2 5 stx 4 sp2 3 stx 2 ix1 4 stx 3 sp1 2 stx 1ix inh inherent rel relative sp1 stack pointer, 8-bit offset imm immediate ix indexed, no offset sp2 stack pointer, 16-bit offset dir direct ix1 indexed, 8-bit offset ix+ indexed, no offset with ext extended ix2 indexed, 16-bit offset post increment dd direct-direct imd immediate-direct ix1+ indexed, 1-byte offset with ix+d indexed-direct dix+ direct-indexed post increment * pre-byte for stack pointer indexed instructions 0 high byte of opcode in hexadecimal low byte of opcode in hexadecimal 0 5 brset0 3 dir cycles opcode mnemonic number of bytes / addressing mode msb lsb msb lsb
mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 69 non-disclosure agreement required advance information mc68hc(9)08pt48 section 4. clock generator module (cgmb) 4.1 contents 4.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 4.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 4.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 4.4.1 crystal oscillator circuit . . . . . . . . . . . . . . . . . . . . . . . . . . .73 4.4.2 phase-locked loop circuit (pll) . . . . . . . . . . . . . . . . . . . .73 4.4.2.1 pll circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 4.4.2.2 acquisition and tracking modes . . . . . . . . . . . . . . . . . . .75 4.4.2.3 manual and automatic pll bandwidth modes . . . . . . . .75 4.4.2.4 programming the pll . . . . . . . . . . . . . . . . . . . . . . . . . . .77 4.4.2.5 special programming exceptions . . . . . . . . . . . . . . . . . .80 4.4.3 base clock selector circuit. . . . . . . . . . . . . . . . . . . . . . . . .80 4.4.4 cgmb external connections . . . . . . . . . . . . . . . . . . . . . . .81 4.5 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 4.5.1 crystal amplifier input pin (osc1) . . . . . . . . . . . . . . . . . . .82 4.5.2 crystal amplifier output pin (osc2) . . . . . . . . . . . . . . . . . .82 4.5.3 external filter capacitor pin (cgmxfc). . . . . . . . . . . . . . .83 4.5.4 pll analog power pin (v dda1 ) . . . . . . . . . . . . . . . . . . . . . .83 4.5.5 pll analog ground pin (v ssa1 ) . . . . . . . . . . . . . . . . . . . . .83 4.5.6 buffered crystal clock output (cgmvout) . . . . . . . . . . . .83 4.5.7 cgmvsel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 4.5.8 oscillator enable signal (simoscen) . . . . . . . . . . . . . . . .84 4.5.9 crystal output frequency signal (cgmxclk) . . . . . . . . . .84 4.5.10 cgmb base clock output (cgmout) . . . . . . . . . . . . . . . .84 4.5.11 cgmb cpu interrupt (cgmint) . . . . . . . . . . . . . . . . . . . . .84 4.6 cgmb registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85 4.6.1 pll control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 4.6.2 pll bandwidth control register . . . . . . . . . . . . . . . . . . . . .90 4.6.3 pll multiplier select register high. . . . . . . . . . . . . . . . . . .92 4.6.4 pll multiplier select register low . . . . . . . . . . . . . . . . . . .93
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 70 clock generator module (cgmb) motorola 4.6.5 pll vco range select register . . . . . . . . . . . . . . . . . . . .94 4.6.6 pll reference divider select register. . . . . . . . . . . . . . . .95 4.7 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8 special modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 4.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 4.9 cgmb during break interrupts. . . . . . . . . . . . . . . . . . . . . . . . .97 4.10 acquisition/lock time specifications . . . . . . . . . . . . . . . . . . . .98 4.10.1 acquisition/lock time definitions . . . . . . . . . . . . . . . . . . . .98 4.10.2 parametric influences on reaction time . . . . . . . . . . . . . .99 4.10.3 choosing a filter capacitor. . . . . . . . . . . . . . . . . . . . . . . .100 4.10.4 reaction time calculation . . . . . . . . . . . . . . . . . . . . . . . .101 4.2 introduction this section describes the clock generator module (cgm, version b). the cgm generates the crystal clock signal, cgmxclk, which operates at the frequency of the crystal. the cgm also generates the base clock signal, cgmout, from which the system integration module (sim) derives the system clocks. cgmout is based on either the crystal clock divided by two or the phase-locked loop (pll) clock, cgmvclk, divided by two. the pll is a fully functional frequency generator designed for use with crystals or ceramic resonators. the pll can generate a 4-mhz bus frequency without using a 16-mhz crystal.
clock generator module (cgmb) features mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 71 non-disclosure agreement required 4.3 features features of the cgmb include: ? phase-locked loop with output frequency in integer multiples of an integer dividend of the crystal reference ? low -requency crystal operation with low-power operation and high-output frequency resolution ? programmable reference divider for even greater resolution ? programmable prescaler for power-of-two increases in frequency ? programmable hardware voltage-controlled oscillator (vco) for low-jitter operation ? automatic bandwidth control mode for low-jitter operation ? automatic frequency lock detector ? cpu interrupt on entry or exit from locked condition ? fast stop recovery mode for exiting stop mode even without a stable crystal 4.4 functional description the cgmb consists of three major submodules: 1. crystal oscillator circuit the crystal oscillator circuit generates the constant crystal frequency clock, cgmxclk. 2. phase-locked loop (pll) the pll generates the programmable vco frequency clock cgmvclk. 3. base clock selector circuit this software-controlled circuit selects either cgmxclk divided by two or the vco clock, cgmvclk, divided by two as the base clock, cgmout. the sim derives the system clocks from cgmout. figure 4-1 shows the structure of the cgm.
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 72 clock generator module (cgmb) motorola figure 4-1. cgmb block diagram bcs phase detector loop filter frequency divider voltage controlled oscillator automatic mode control lock detector clock cgmxclk cgmout cgmvdv cgmvclk simoscen crystal oscillator interrupt control cgmint cgmrdv pll analog ? 2 cgmrclk osc2 osc1 select circuit v dda1 pllxfc v ssa1 lock auto acq vpr[1:0] pllie pllf mul[11:0] reference divider rds[3:0] vrs[7:0] frequency divider pre[1:0]
clock generator module (cgmb) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 73 non-disclosure agreement required 4.4.1 crystal oscillator circuit the crystal oscillator circuit consists of an inverting amplifier and an external crystal. the osc1 pin is the input to the amplifier and the osc2 pin is the output. the simoscen signal from the system integration module (sim) enables the crystal oscillator circuit. the cgmxclk signal is the output of the crystal oscillator circuit and runs at a rate equal to the crystal frequency. cgmxclk is then buffered to produce cgmrclk, the pll reference clock. cgmxclk can be used by other modules which require precise timing for operation. the duty cycle of cgmxclk is not guaranteed to be 50% and depends on external factors, including the crystal and related external components. an externally generated clock also can feed the osc1 pin of the crystal oscillator circuit. connect the external clock to the osc1 pin and let the osc2 pin float. 4.4.2 phase-locked loop circuit (pll) the pll is a frequency generator that can operate in either acquisition mode or tracking mode, depending on the accuracy of the output frequency. the pll can change between acquisition and tracking modes either automatically or manually. 4.4.2.1 pll circuits the pll consists of these circuits: ? voltage-controlled oscillator (vco) ? reference divider ? frequency prescaler ? modulo vco frequency divider ? phase detector ? loop filter ? lock detector
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 74 clock generator module (cgmb) motorola the operating range of the vco is programmable for a wide range of frequencies and for maximum immunity to external noise, including supply and cgmxfc noise. the vco frequency is bound to a range from roughly one-half to twice the center-of-range frequency, f vrs . modulating the voltage on the cgmxfc pin changes the frequency within this range. by design, f vrs is equal to the nominal center-of-range frequency, f nom , (38.4 khz) times a linear factor, l, and a power-of-two factor, e, or (l 2 e )f nom . cgmrclk is the pll reference clock, a buffered version of cgmxclk. cgmrclk runs at a frequency, f rclk , and is fed to the pll through a programmable modulo reference divider, which divides f rclk by a factor r. this feature allows frequency steps of higher resolution. the dividers output is the final reference clock, cgmrdv, running at a frequency f rdv =f rclk /r. the vcos output clock, cgmvclk, running at a frequency f vclk , is fed back through a programmable prescale divider and a programmable modulo divider. the prescaler divides the vco clock by a power-of-two factor p and the modulo divider reduces the vco clock by a factor, n. the dividers output is the vco feedback clock, cgmvdv, running at a frequency, f vdv =f vclk /(n 2 p ). (see 4.4.2.4 programming the pll for more information.) the phase detector then compares the vco feedback clock, cgmvdv, with the final reference clock, cgmrdv. a correction pulse is generated based on the phase difference between the two signals. the loop filter then slightly alters the dc voltage on the external capacitor connected to cgmxfc based on the width and direction of the correction pulse. the filter can make fast or slow corrections depending on its mode, described in 4.4.2.2 acquisition and tracking modes . the value of the external capacitor and the reference frequency determines the speed of the corrections and the stability of the pll. the lock detector compares the frequencies of the vco feedback clock, cgmvdv, and the final reference clock, cgmrdv. therefore, the speed of the lock detector is directly proportional to the final reference frequency f rdv . the circuit determines the mode of the pll and the lock condition based on this comparison.
clock generator module (cgmb) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 75 non-disclosure agreement required 4.4.2.2 acquisition and tracking modes the pll filter is manually or automatically configurable into one of two operating modes: ? acquisition mode in acquisition mode, the filter can make large frequency corrections to the vco. this mode is used at pll start- up or when the pll has suffered a severe noise hit and the vco frequency is far off the desired frequency. when in acquisition mode, the acq bit is clear in the pll bandwidth control register. (see 4.6.2 pll bandwidth control register .) ? tracking mode in tracking mode, the filter makes only small corrections to the frequency of the vco. pll jitter is much lower in tracking mode, but the response to noise is also slower. the pll enters tracking mode when the vco frequency is nearly correct, such as when the pll is selected as the base clock source. (see 4.4.3 base clock selector circuit .) the pll is automatically in tracking mode when not in acquisition mode or when the acq bit is set. 4.4.2.3 manual and automatic pll bandwidth modes the pll can change the bandwidth or operational mode of the loop filter manually or automatically. in automatic bandwidth control mode (auto = 1), the lock detector automatically switches between acquisition and tracking modes. automatic bandwidth control mode also is used to determine when the vco clock, cgmvclk, is safe to use as the source for the base clock, cgmout. (see 4.6.2 pll bandwidth control register .) if pll interrupts are enabled, the software can wait for a pll interrupt request and then check the lock bit. if interrupts are disabled, software can poll the lock bit continuously (during pll startup, usually) or at periodic intervals. in either case, when the lock bit is set, the vco clock is safe to use as the source for the base clock. (see 4.4.3 base clock selector circuit .) if the vco is selected as the source for the base clock and the lock bit is clear, the pll has suffered a severe noise hit and the software must take appropriate action, depending on the application. (see 4.7 interrupts for information and precautions on using interrupts.)
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 76 clock generator module (cgmb) motorola the following conditions apply when the pll is in automatic bandwidth control mode: ? the acq bit (see 4.6.2 pll bandwidth control register ) is a read-only indicator of the mode of the filter. (see 4.4.2.2 acquisition and tracking modes .) ? the acq bit is set when the vco frequency is within a certain tolerance, d trk , and is cleared when the vco frequency is out of a certain tolerance, d unt . (see 4.10 acquisition/lock time specifications for more information.) ? the lock bit is a read-only indicator of the locked state of the pll. ? the lock bit is set when the vco frequency is within a certain tolerance, d lock , and is cleared when the vco frequency is out of a certain tolerance, d unl . (see 4.10 acquisition/lock time specifications for more information.) ? cpu interrupts can occur if enabled (pllie = 1) when the plls lock condition changes, toggling the lock bit. (see 4.6.1 pll control register .) the pll also may operate in manual mode (auto = 0). manual mode is used by systems that do not require an indicator of the lock condition for proper operation. such systems typically operate well below f busmax and require fast startup. the following conditions apply when in manual mode: ? acq is a writable control bit that controls the mode of the filter. before turning on the pll in manual mode, the acq bit must be clear. ? before entering tracking mode ( acq = 1), software must wait a given time, t acq (see 4.10 acquisition/lock time specifications ), after turning on the pll by setting pllon in the pll control register (pctl). ? software must wait a given time, t al , after entering tracking mode before selecting the pll as the clock source to cgmout (bcs = 1). ? the lock bit is disabled. ? cpu interrupts from the cgmb are disabled.
clock generator module (cgmb) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 77 non-disclosure agreement required 4.4.2.4 programming the pll the following procedure shows how to program the pll. note: the round function in the following equations means that the real number should be rounded to the nearest integer number. 1. choose the desired bus frequency, f busdes . 2. calculate the desired vco frequency (four times the desired bus frequency). 3. choose a practical pll reference frequency, f rclk . 4. select the prescaler power-of-two multiplier, p. 5. select the reference divider based on the resolution desired. for maximum resolution, use this formula. however, higher degrees of resolution slow down the final reference frequency, which may cause acquisition time to increase and may affect the value of the external capacitor. for more information, see 4.10 acquisition/lock time specifications . select a vco frequency multiplier, n. f vclkdes 4f busdes = p integer 2 pmax f vclkdes f vclkmax ----------------------------------------------- ? ? ?? log 2 () log ------------------------------------------------------------- - 1 + = r round r max f vclkdes 2 p f rclk --------------------------- ? ? ?? integer f vclkdes 2 p f rclk --------------------------- ? ? ?? C ?t y = n round rf vclkdes 2 p f rclk ---------------------------------- - ? ? ?? =
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 78 clock generator module (cgmb) motorola 6. for fastest acquisition time, reduce n/r until r is the smallest value possible. for example, i fn=6andr=4,n reduces to 3 and r reduces to 2. 7. calculate and verify the adequacy of the vco and bus frequencies f vclk and f bus . 8. select the vcos power-of-two range multiplier e. higher values of e should be used at higher frequencies. select a vco linear range multiplier, l, where f nom = 38.4 khz 9. calculate and verify the adequacy of the vco programmed center-of-range frequency f vrs . f vrs = (l 2 e )f nom 10. verify the choice of p, r, n, e, and l by comparing f vclk to f vrs and f vclkdes . for proper operation, f vclk must be within the applications tolerance of f vclkdes , and f vrs must be as close as possible to f vclk . note: exceeding the recommended maximum bus frequency or vco frequency can crash the mcu. f vclk nf rclk = f vclk 2 p nr () f rclk = f bus f vclk () 4 = e integer 2 emax f vclk f vrsmax ------------------------------------- ? ? ?? log 2 () log --------------------------------------------------- - 1 + = l round f vclk 2 e f nom ------------------------- ? ? ?? =
clock generator module (cgmb) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 79 non-disclosure agreement required 11. program the pll registers accordingly: a. in the pre bits of the pll control register , program the binary equivalent of p. b. in the vpr bits of the pll control register , program the binary equivalent of e. c. in the pll multiplier select register low and the pll multiplier select register high , program the binary equivalent of n. d. in the pll vco range select register , program the binary coded equivalent of l. e. in the pll reference divider select register , program the binary coded equivalent of r. table 4-1 provides a numeric example with numbers in hexadecimal notation. table 4-1. numeric example bus frequency e p n l r 307,200 hz 1 1 10 10 1 614,400 hz 1 1 20 20 1 652,800 hz 2 2 11 11 1 691,200 hz 2 2 12 12 1 729,600 hz 2 2 13 13 1 768,000 hz 2 2 14 14 1 806,400 hz 2 2 15 15 1 998,400 hz 2 2 1a 1a 1
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 80 clock generator module (cgmb) motorola 4.4.2.5 special programming exceptions the programming method described in 4.4.2.4 programming the pll does not account for three possible exceptions. a value of zero for r, n, or l is meaningless when used in the equations given. to account for these exceptions: ? a 0 value for r or n is interpreted exactly the same as a value of 1. at the minimum frequency and the vco range power-of-two bits.this mode is currently disabled in mt2. ? a 0 value for l disables the pll and prevents its selection as the source for the base clock. (see 4.4.3 base clock selector circuit .) 4.4.3 base clock selector circuit this circuit is used to select either the crystal clock, cgmxclk, or the vco clock, cgmvclk, as the source of the base clock, cgmout. the two input clocks go through a transition control circuit that waits up to three cgmxclk cycles and three cgmvclk cycles to change from one clock source to the other. during this time, cgmout is held in stasis. the output of the transition control circuit is then divided by two to correct the duty cycle. therefore, the bus clock frequency, which is one-half of the base clock frequency, is one-fourth the frequency of the selected clock (cgmxclk or cgmvclk). the bcs bit in the pll control register (pctl) selects which clock drives cgmout. the vco clock cannot be selected as the base clock source if the pll is not turned on. the pll cannot be turned off if the vco clock is selected. the pll cannot be turned on or off simultaneously with the selection or deselection of the vco clock. the vco clock also cannot be selected as the base clock source if the factor l is programmed to a 0. this value would set up a condition inconsistent with the operation of the pll, so that the pll would be disabled and the crystal clock would be forced as the source of the base clock.
clock generator module (cgmb) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 81 non-disclosure agreement required 4.4.4 cgmb external connections in its typical configuration, the cgmb requires seven external components. five of these are for the crystal oscillator and two are for the pll. the crystal oscillator is normally connected in a pierce oscillator configuration, as shown in figure 4-2 . figure 4-2 shows only the logical representation of the internal components and may not represent actual circuitry. the oscillator configuration uses five components: ? crystal, x 1 ? fixed capacitor, c 1 ? tuning capacitor, c 2 ; can also be a fixed capacitor ? feedback resistor, r b ? series resistor, r s ; optional the series resistor (r s ) is included in the diagram to follow strict pierce oscillator guidelines and may not be required for all ranges of operation, especially with high frequency crystals. refer to the crystal manufacturers data for more information. figure 4-2 also shows the external components for the pll: ? bypass capacitor, c byp ? filter capacitor, c f routing should be done with great care to minimize signal cross talk and noise.
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 82 clock generator module (cgmb) motorola figure 4-2. cgmb external connections 4.5 i/o signals the following paragraphs describe the cgmb i/o (input/output) signals. the cgm may also have up to four additional inputs, if enabled in mt2. 4.5.1 crystal amplifier input pin (osc1) the osc1 pin is an input to the crystal oscillator amplifier. 4.5.2 crystal amplifier output pin (osc2) the osc2 pin is the output of the crystal oscillator inverting amplifier. c 1 c 2 c f simoscen cgmxclk r b x 1 r s * c byp osc1 osc2 v ss cgmxfc v dda1 *rs can be 0 (shorted) when used with higher-frequency crystals. refer to manufacturers data. v dd
clock generator module (cgmb) i/o signals mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 83 non-disclosure agreement required 4.5.3 external filter capacitor pin (cgmxfc) the cgmxfc pin is required by the loop filter to filter out phase corrections. a small external capacitor is connected to this pin. note: to prevent noise problems, c f should be placed as close to the cgmxfc pin as possible, with minimum routing distances and no routing of other signals across the c f connection. 4.5.4 pll analog power pin (v dd1 ) v dda1 is a power pin used by the analog portions of the pll. connect the v dda1 pin to the same voltage potential as the v dd pin. note: route v dda1 carefully for maximum noise immunity and place bypass capacitors as close as possible to the package. 4.5.5 pll analog ground pin (v ssa1 ) v ssa1 is a ground pin used by the analog portions of the pll. connect the v ssa1 pin to the same voltage potential as the v ss pin. note: route v ssa1 carefully for maximum noise immunity and place bypass capacitors as close as possible to the package. 4.5.6 buffered crystal clock output (cgmvout) cgmvout buffers the osc1 clock for external use. 4.5.7 cgmvsel cgmvsel must be tied low or floated.
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 84 clock generator module (cgmb) motorola 4.5.8 oscillator enable signal (simoscen) the simoscen signal comes from the system integration module (sim) and enables the oscillator and pll. 4.5.9 crystal output frequency signal (cgmxclk) cgmxclk is the crystal oscillator output signal. it runs at the full speed of the crystal (f xclk ) and comes directly from the crystal oscillator circuit. figure 4-2 shows only the logical relation of cgmxclk to osc1 and osc2 and may not represent the actual circuitry. the duty cycle of cgmxclk is unknown and may depend on the crystal and other external factors. also, the frequency and amplitude of cgmxclk can be unstable at startup. 4.5.10 cgmb base clock output (cgmout) cgmout is the clock output of the cgmb. this signal goes to the sim, which generates the mcu clocks. cgmout is a 50 percent duty cycle clock running at twice the bus frequency. cgmout is software programmable to be either the oscillator output, cgmxclk, divided by two or the vco clock, cgmvclk, divided by two. 4.5.11 cgmb cpu interrupt (cgmint) cgmint is the interrupt signal generated by the pll lock detector.
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 85 non-disclosure agreement required 4.6 cgmb registers the following registers control and monitor operation of the cgmb: ? pll control register (pctl) see 4.6.1 pll control register . ? pll bandwidth control register (pbwc) see 4.6.2 pll bandwidth control register . ? pll multiplier select register high (pmsh) see 4.6.3 pll multiplier select register high . ? pll multiplier select register low (pmsl) see 4.6.4 pll multiplier select register low . ? pll vco range select register see 4.6.5 pll vco range select register . ? pll reference divider select register (prds) see 4.6.6 pll reference divider select register . figure 4-3 is a summary of the cgmb registers.
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 86 clock generator module (cgmb) motorola addr. register name bit 7 6 5 4 3 2 1 bit 0 $0046 pll control register (pctl) read: pllie pllf pllon bcs pre1 pre0 vpr1 vpr0 write: reset: 0 0 1 0 1 1 1 1 $0047 pll bandwidth control register (pbwc) read: auto lock a cq 0000 coe write: reset: 0 0 0 0 0 0 0 0 $0048 pll multiplier select register high (pmsh) read: 0 0 0 0 mul11 mul10 mul9 mul8 write: reset: 0 0 0 0 0 0 0 0 $0049 pll multiplier select register low (pmsl) read: mul7 mul6 mul5 mul4 mul3 mul2 mul1 mul0 write: reset: 0 0 0 0 0 0 0 0 $004a pll vco range select register (pvrs) read: vrs7 vrs6 vrs5 vrs4 vrs3 vrs2 vrs1 vrs0 write: reset: 0 1 0 0 0 0 0 0 $004b pll reference divider select register (prds) read: 0 0 0 0 rds3 rds2 rds1 rds0 write: reset: 0 0 0 0 0 0 0 1 = unimplemented notes: 1. when auto = 0, pllie is forced clear and is read only. 2. when auto = 0, pllf and lock read as clear. 3. when auto = 1, a cq is read-only. 4. when pllon = 0 or vrs7:vrs0 = $0, bcs is forced clear and is read only. 5. when pllon = 1, the pll programming register is read only. 6. when bcs = 1, pllon is forced set and is read only. figure 4-3. cgmb i/o register summary
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 87 non-disclosure agreement required 4.6.1 pll control register the pll control register contains the interrupt enable and flag bits, the on/off switch, the base clock selector bit, the prescaler bits, and the vco power-of-two range selector bits. pllie pll interrupt enable bit this read/write bit enables the pll to generate an interrupt request when the lock bit toggles, setting the pll flag, pllf. when the auto bit in the pll bandwidth control register (pbwc) is clear, pllie cannot be written and reads as logic 0. reset clears the pllie bit. 1 = pll interrupts enabled 0 = pll interrupts disabled pllf pll interrupt flag bit this read-only bit is set whenever the lock bit toggles. pllf generates an interrupt request if the pllie bit also is set. pllf always reads as logic 0 when the auto bit in the pll bandwidth control register (pbwc) is clear. clear the pllf bit by reading the pll control register. reset clears the pllf bit. 1 = change in lock condition 0 = no change in lock condition note: do not inadvertently clear the pllf bit. any read or read-modify-write operation on the pll control register clears the pllf bit. address: $0046 bit 7 654321 bit 0 read: pllie pllf pllon bcs pre1 pre0 vpr1 vpr0 write: reset: 00101111 = unimplemented figure 4-4. pll control register (pctl)
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 88 clock generator module (cgmb) motorola pllon pll on bit this read/write bit activates the pll and enables the vco clock, cgmvclk. pllon cannot be cleared if the vco clock is driving the base clock, cgmout (bcs = 1). (see 4.4.3 base clock selector circuit .) reset sets this bit so that the loop can stabilize as the mcu is powering up. 1 = pll on 0 = pll off bcs base clock select bit this read/write bit selects either the crystal oscillator output, cgmxclk, or the vco clock, cgmvclk, as the source of the cgm output, cgmout. cgmout frequency is one-half the frequency of the selected clock. bcs cannot be set while the pllon bit is clear. after toggling bcs, it may take up to three cgmxclk and three cgmvclk cycles to complete the transition from one source clock to the other. during the transition, cgmout is held in stasis. (see 4.4.3 base clock selector circuit .) reset clear the bcs bit. 1 = cgmvclk divided by two drives cgmout 0 = cgmxclk divided by two drives cgmout note: pllon and bcs have built-in protection that prevents the base clock selector circuit from selecting the vco clock as the source of the base clock if the pll is off. therefore, pllon cannot be cleared when bcs is set, and bcs cannot be set when pllon is clear. if the pll is off (pllon = 0), selecting cgmvclk requires two writes to the pll control register. (see 4.4.3 base clock selector circuit .) pre1 and pre0 prescaler program bits these read/write bits control a prescaler that selects the prescaler power-of-two multiplier p. (see 4.4.2.1 pll circuits and 4.4.2.4 programming the pll .) pre1 and pre0 cannot be written when the pllon bit is set. reset clears these bits. (see table 4-2 .)
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 89 non-disclosure agreement required vpr1 and vpr0 vco power-of-two range select bits these read/write bits control the vcos hardware power-of-two range multiplier e that, in conjunction with l (see 4.4.2.1 pll circuits , 4.4.2.4 programming the pll , and 4.6.5 pll vco range select register .) controls the hardware center-of-range frequency f vrs . vpr1:vpr0 cannot be written when the pllon bit is set. reset clears these bits. (see table 4-3 .) table 4-2. pre1 and pre0 programming pre1 and pre0 p prescaler multiplier 00 0 1 01 1 2 10 2 4 11 3 8 table 4-3. vpr1 and vpr0 programming vpr1 and vpr0 e vco power-of-two range multiplier 00 0 1 01 1 2 10 2 4 11 3 8
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 90 clock generator module (cgmb) motorola 4.6.2 pll bandwidth control register the pll bandwidth control register: ? selects automatic or manual (software-controlled) bandwidth control mode ? indicates when the pll is locked ? in automatic bandwidth control mode, indicates when the pll is in acquisition or tracking mode ? in manual operation, forces the pll into acquisition or tracking mode auto automatic bandwidth control bit this read/write bit selects automatic or manual bandwidth control. when initializing the pll for manual operation (auto = 0), clear the acq bit before turning on the pll. reset clears the auto bit. 1 = automatic bandwidth control 0 = manual bandwidth control lock lock indicator bit when the auto bit is set, lock is a read-only bit that becomes set when the vco clock, cgmvclk, is locked (running at the programmed frequency). when the auto bit is clear, lock reads as logic 0 and has no meaning. the write function of this bit is reserved for test, so this bit must always be written a 0. reset clears the lock bit. 1 = vco frequency correct or locked 0 = vco frequency incorrect or unlocked address: $0047 bit 7 654321 bit 0 read: auto lock a cq 0000 coe write: reset: 00000000 = unimplemented figure 4-5. pll bandwidth control register (pbwc)
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 91 non-disclosure agreement required acq acquisition mode bit when the auto bit is set, acq is a read-only bit that indicates whether the pll is in acquisition mode or tracking mode. when the auto bit is clear, acq is a read/write bit that controls whether the pll is in acquisition or tracking mode. in automatic bandwidth control mode (auto = 1), the last-written value from manual operation is stored in a temporary location and is recovered when manual operation resumes. reset clears this bit, enabling acquisition mode. 1 = tracking mode 0 = acquisition mode coe clock out enable when the coe bit is cleared, a buffered version of osc1 is present on the cgmvout pin. when the coe bit is set, the cgmvout pin will be driven low. 1 = cgmvout driven low 0 = cgmvout is buffered osc1
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 92 clock generator module (cgmb) motorola 4.6.3 pll multiplier select register high the pll multiplier select register high contains the programming information for the high byte of the modulo feedback divider. mul[11:8] multiplier select bits these read/write bits control the high byte of the modulo feedback divider that selects the vco frequency multiplier n. (see 4.4.2.1 pll circuits and 4.4.2.4 programming the pll .) a value of $0000 in the multiplier select registers configures the modulo feedback divider the same as a value of $0001. reset initializes the registers to $0040 for a default multiply value of 64. note: the multiplier select bits have built-in protection such that they cannot be written when the pll is on (pllon = 1). address: $0048 bit 7 654321 bit 0 read: 0000 mul11 mul10 mul9 mul8 write: reset: 00000000 = unimplemented figure 4-6. pll multiplier select register high (pmsh)
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 93 non-disclosure agreement required 4.6.4 pll multiplier select register low the pll multiplier select register low contains the programming information for the low byte of the modulo feedback divider. mul[7:0] multiplier select bits these read/write bits control the low byte of the modulo feedback divider that selects the vco frequency multiplier, n. (see 4.4.2.1 pll circuits and 4.4.2.4 programming the pll .) mul[7:0] cannot be written when the pllon bit in the pctl is set. a value of $0000 in the multiplier select registers configures the modulo feedback divider the same as a value of $0001. reset initializes the register to $40 for a default multiply value of 64. note: the multiplier select bits have built-in protection such that they cannot be written when the pll is on (pllon = 1). address: $0049 bit 7 654321 bit 0 read: mul7 mul6 mul5 mul4 mul3 mul2 mul1 mul0 write: reset: 00000000 figure 4-7. pll multiplier select register low (pmsl)
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 94 clock generator module (cgmb) motorola 4.6.5 pll vco range select register the pll vco range select register contains the programming information required for the hardware configuration of the vco. vrs[7:0] vco range select bits these read/write bits control the hardware center-of-range linear multiplier l which, in conjunction with e (see 4.4.2.1 pll circuits , 4.4.2.4 programming the pll , and 4.6.1 pll control register ), controls the hardware center-of-range frequency, f vrs . vrs[7:0] cannot be written when the pllon bit in the pctl is set. (see 4.4.2.5 special programming exceptions . ) a value of $00 in the vco range select register disables the pll and clears the bcs bit in the pll control register . (see 4.4.3 base clock selector circuit and 4.4.2.5 special programming exceptions .) reset initializes the register to $40 for a default range multiply value of 64. note: the vco range select bits have built in protection such that they cannot be written when the pll is on (pllon = 1) and such that the vco clock cannot be selected as the source of the base clock (bcs = 1) if the vco range select bits are all clear. the pll vco range select register must be programmed correctly. incorrect programming may result in failure of the pll to achieve lock. address: $004a bit 7 654321 bit 0 read: vrs7 vrs6 vrs5 vrs4 vrs3 vrs2 vrs1 vrs0 write: reset: 01000000 figure 4-8. pll vco range select register (pvrs)
clock generator module (cgmb) cgmb registers mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 95 non-disclosure agreement required 4.6.6 pll reference divider select register the pll reference divider select register contains the programming information for the modulo reference divider. rds[3:0] reference divider select bits these read/write bits control the modulo reference divider that selects the reference division factor r. (see 4.4.2.1 pll circuits and 4.4.2.4 programming the pll .) rds[7:0] cannot be written when the pllon bit in the pctl is set. a value of $00 in the reference divider select register configures the reference divider the same as a value of $01. (see 4.4.2.5 special programming exceptions .) reset initializes the register to $01 for a default divide value of 1. note: the reference divider select bits have built-in protection such that they cannot be written when the pll is on (pllon = 1). prds[7:4] unimplemented bits these bits have no function and always read as logic 0s. address: $004b bit 7 654321 bit 0 read: 0000 rds3 rds2 rds1 rds0 write: reset: 00000001 = unimplemented figure 4-9. pll reference divider select register (prds)
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 96 clock generator module (cgmb) motorola 4.7 interrupts when the auto bit is set in the pll bandwidth control register (pbwc), the pll can generate a cpu interrupt request every time the lock bit changes state. the pllie bit in the pll control register (pctl) enables cpu interrupts from the pll. pllf, the interrupt flag in the pctl, becomes set whether interrupts are enabled or not. when the auto bit is clear, cpu interrupts from the pll are disabled and pllf reads as logic 0. software should read the lock bit after a pll interrupt request to see if the request was due to an entry into lock or an exit from lock. when the pll enters lock, the vco clock, cgmvclk, divided by two can be selected as the cgmout source by setting bcs in the pctl. when the pll exits lock, the vco clock frequency is corrupt and appropriate precautions should be taken. if the application is not frequency sensitive, interrupts should be disabled to prevent pll interrupt service routines from impeding software performance or from exceeding stack limitations. note: software can select the cgmvclk divided by two as the cgmout source even if the pll is not locked (lock = 0). therefore, software should make sure the pll is locked before setting the bcs bit. 4.8 special modes the wait and stop instructions put the mcu in low power- consumption standby mode. 4.8.1 wait mode the wait instruction does not affect the cgmb. before entering wait mode, software can disengage and turn off the pll by clearing the bcs and pllon bits in the pll control register (pctl). less power-sensitive applications can disengage the pll without turning it off. applications that require the pll to wake the mcu from wait mode also can deselect the pll output without turning off the pll.
clock generator module (cgmb) cgmb during break interrupts mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 97 non-disclosure agreement required 4.8.2 stop mode the stop instruction disables the cgmb and holds low all cgmb outputs (cgmxclk, cgmout, and cgmint). if the stop instruction is executed with the vco clock, cgmvclk, divided by two driving cgmout, the pll automatically clears the bcs bit in the pll control register (pctl), thereby selecting the crystal clock, cgmxclk, divided by two as the source of cgmout. when the mcu recovers from stop, the crystal clock divided by two drives cgmout and bcs remains clear. 4.9 cgmb during break interrupts the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. (see 7.8.3 sim break flag control register .) to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the pllf bit during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write the pll control register during the break state without affecting the pllf bit. if this mode is desired during reset, the reset conditions of bcs and pllon must be set. if this mode is desired for use in applications where no crystal is used, the bcs and pllon bits must not be clearable. during a large frequency change, the software must allow a stabilization time. the cgmxclk signal will always reflect the crystal clock, so the value of cgmxclk upon removing the crystal will reflect the value of the osc1 pin. if osc1 is floating, the module could consume significant power and the output of the cgmxclk signal would be indeterminate.
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 98 clock generator module (cgmb) motorola 4.10 acquisition/lock time specifications the acquisition and lock times of the pll are, in many applications, the most critical pll design parameters. proper design and use of the pll ensures the highest stability and lowest acquisition/lock times. 4.10.1 acquisition/lock time definitions typical control systems refer to the acquisition time or lock time as the reaction time, within specified tolerances, of the system to a step input. in a pll, the step input occurs when the pll is turned on or when it suffers a noise hit. the tolerance is usually specified as a percent of the step input or when the output settles to the desired value plus or minus a percent of the frequency change. therefore, the reaction time is constant in this definition, regardless of the size of the step input. for example, consider a system wit h a 5 percent acquisition time tolerance. if a command instructs the system to change from 0 hz to 1 mhz, the acquisition time is the time taken for the frequency to reach 1 mhz 50 khz. fifty khz = 5% of the 1-mhz step input. if the system is operating at 1 mhz and suffers a C100-khz noise hit, the acquisition time is the time taken to return from 900 khz to 1 mhz 5 khz. five khz = 5% of the 100-khz step input. other systems refer to acquisition and lock times as the time the system takes to reduce the error between the actual output and the desired output to within specified tolerances. therefore, the acquisition or lock time varies according to the original error in the output. minor errors may not even be registered. typical pll applications prefer to use this definition because the system requires the output frequency to be within a certain tolerance of the desired frequency regardless of the size of the initial error. the discrepancy in these definitions makes it difficult to specify an acquisition or lock time for a typical pll. therefore, the definitions for acquisition and lock times for this module are: ? acquisition time, t acq , is the time the pll takes to reduce the error between the actual output frequency and the desired output frequency to less than the tracking mode entry tolerance, d trk .
clock generator module (cgmb) acquisition/lock time specifications mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 99 non-disclosure agreement required acquisition time is based on an initial frequency error, (f des C f orig )/f des , of not more than 100 percent. in automatic bandwidth control mode (see 4.4.2.3 manual and automatic pll bandwidth modes ), acquisition time expires when the acq bit becomes set in the pll bandwidth control register (pbwc). ? lock time, t lock , is the time the pll takes to reduce the error between the actual output frequency and the desired output frequency to less than the lock mode entry tolerance, d lock . lock time is based on an initial frequency error, (f des C f orig )/f des , of not more than 100 percent. in automatic bandwidth control mode, lock time expires when the lock bit becomes set in the pll bandwidth control register (pbwc). (see 4.4.2.3 manual and automatic pll bandwidth modes .) obviously, the acquisition and lock times can vary according to how large the frequency error is and may be shorter or longer in many cases. 4.10.2 parametric influences on reaction time acquisition and lock times are designed to be as short as possible while still providing the highest possible stability. these reaction times are not constant, however. many factors directly and indirectly affect the acquisition time. the most critical parameter which affects the reaction times of the pll is the reference frequency, f rdv . this frequency is the input to the phase detector and controls how often the pll makes corrections. for stability, the corrections must be small compared to the desired frequency, so several corrections are required to reduce the frequency error. therefore, the slower the reference the longer it takes to make these corrections. this parameter is also under user control via the choice of crystal frequency f xclk and the r value programmed in the reference divider. (see 4.4.2.1 pll circuits , 4.4.2.4 programming the pll , and 4.6.6 pll reference divider select register ). another critical parameter is the external filter capacitor. the pll modifies the voltage on the vco by adding or subtracting charge from this capacitor. therefore, the rate at which the voltage changes for a
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 100 clock generator module (cgmb) motorola given frequency error (thus change in charge) is proportional to the capacitor size. the size of the capacitor also is related to the stability of the pll. if the capacitor is too small, the pll cannot make small enough adjustments to the voltage and the system cannot lock. if the capacitor is too large, the pll may not be able to adjust the voltage in a reasonable time. (see 4.10.3 choosing a filter capacitor .) also important is the operating voltage potential applied to v dda1 . the power supply potential alters the characteristics of the pll. a fixed value is best. variable supplies, such as batteries, are acceptable if they vary within a known range at very slow speeds. noise on the power supply is not acceptable, because it causes small frequency errors which continually change the acquisition time of the pll. temperature and processing also can affect acquisition time because the electrical characteristics of the pll change. the part operates as specified as long as these influences stay within the specified limits. external factors, however, can cause drastic changes in the operation of the pll. these factors include noise injected into the pll through the filter capacitor, filter capacitor leakage, stray impedances on the circuit board, and even humidity or circuit board contamination. 4.10.3 choosing a filter capacitor as described in 4.10.2 parametric influences on reaction time , the external filter capacitor, c f , is critical to the stability and reaction time of the pll. the pll is also dependent on reference frequency and supply voltage. the value of the capacitor must, therefore, be chosen with supply potential and reference frequency in mind. for proper operation, the external filter capacitor must be chosen according to this equation: for acceptable values of c fact , see 4.10 acquisition/lock time specifications . for the value of v dda1 , choose the voltage potential at which the mcu is operating. if the power supply is variable, choose a value near the middle of the range of possible supply values. c f c fact v dda f rdv ------------ - ? ?? =
clock generator module (cgmb) acquisition/lock time specifications mc68hc(9)08pt48 rev. 2.0 advance information motorola clock generator module (cgmb) 101 non-disclosure agreement required this equation does not always yield a commonly available capacitor size, so round to the nearest available size. if the value is between two different sizes, choose the higher value for better stability. choosing the lower size may seem attractive for acquisition time improvement, but the pll may become unstable. also, always choose a capacitor with a tight tolerance ( 20 percent or better) and low dissipation. 4.10.4 reaction time calculation the actual acquisition and lock times can be calculated using the equations in this section. these equations yield nominal values under the following conditions: ? correct selection of filter capacitor, c f (see 4.10.3 choosing a filter capacitor .) ? room temperature operation ? negligible external leakage on cgmxfc ? negligible noise the k factor in the equations is derived from internal pll parameters. k acq is the k factor when the pll is configured in acquisition mode, and k trk is the k factor when the pll is configured in tracking mode. (see 4.4.2.2 acquisition and tracking modes .) note:t he inverse proportionality between the lock time and the reference frequency. in automatic bandwidth control mode the acquisition and lock times are quantized into units based on the reference frequency. (see 4.4.2.3 manual and automatic pll bandwidth modes .) a certain number of t acq v dda f rdv ------------- - ? ?? 8 k acq -------------- ? ?? = t al v dda f rdv ------------- - ? ?? 4 k trk ------------- ? ?? = t lock t acq t al + =
non-disclosure agreement required clock generator module (cgmb) advance information mc68hc(9)08pt48 rev. 2.0 102 clock generator module (cgmb) motorola clock cycles, n acq , is required to ascertain that the pll is within the tracking mode entry tolerance, d trk , before exiting acquisition mode. a certain number of clock cycles, n trk , is required to ascertain that the pll is within the lock mode entry tolerance, d lock . therefore, the acquisition time, t acq , is an integer multiple of n acq /f rdv , and the acquisition to lock time, t al , is an integer multiple of n trk /f rdv . also, since the average frequency over the entire measurement period must be within the specified tolerance, the total time usually is longer than t lock as calculated earlier. in manual mode, it is usually necessary to wait considerably longer than t lock before selecting the pll clock (see 4.4.3 base clock selector circuit ) because the factors described in 4.10.2 parametric influences on reaction time may slow the lock time considerably.
mc68hc(9)08pt48 rev. 2.0 advance information motorola computer operating properly (cop) module 103 non-disclosure agreement required advance information mc68hc(9)08pt48 section 5. computer operating properly (cop) module 5.1 contents 5.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 5.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 5.4 i/o signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.1 cgmxclk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.2 stop instruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.3 copctl write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.4 power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.5 internal reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.6 reset vetor fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 5.4.7 copd (cop disable) . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.5 cop control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.6 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.7 monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.8 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 5.8.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 5.8.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 5.9 cop module during break interrupts . . . . . . . . . . . . . . . . . . .107 5.2 introduction this section describes the computer operating properly module (cop, version b10), a free-running counter that generates a reset if allowed to overflow. the cop module helps software recover from runaway code. prevent a cop reset by periodically clearing the cop counter.
non-disclosure agreement required computer operating properly (cop) module advance information mc68hc(9)08pt48 rev. 2.0 104 computer operating properly (cop) module motorola 5.3 functional description figure 5-1. cop block diagram the cop counter uses a free-running 6-bit counter preceded by the 13- bit system integration module (sim) counter. if not cleared by software, the cop counter overflows and generates an asynchronous reset after 2 18 C2 4 cgmxclk cycles. with a 38.4-khz crystal, the cop timeout period is 6.83 seconds. writing any value to location $ffff before overflow occurs clears the cop counter and prevents reset. a cop reset pulls the rst pin low for 32 cgmxclk cycles and sets the cop bit in the sim reset status register (srsr). clear the cop immediately before entering or after exiting stop mode to assure a full cop timeout period after entering or exiting stop mode. a cpu interrupt routine or a dma service routine can be used to clear the cop. note: place cop clearing instructions in the main program and not in an interrupt subroutine. such an interrupt subroutine could keep the cop from generating a reset even while the main program is not working properly. cgmxclk 12-bit sim counter sim reset circuit 6-bit cop counter sim reset status register sim cop stop instruction internal reset reset vector fetch copctl write copen (from sim) copd (from mor) reset copctl write
computer operating properly (cop) module i/o signals mc68hc(9)08pt48 rev. 2.0 advance information motorola computer operating properly (cop) module 105 non-disclosure agreement required 5.4 i/o signals this section describes the signals shown in figure 5-1 . 5.4.1 cgmxclk cgmxclk is the crystal oscillator output signal. cgmxclk frequency is equal to the crystal frequency. 5.4.2 stop instruction the stop instruction clears the sim counter. 5.4.3 copctl write writing any value to the cop control register (copctl) clears the cop counter and clears bits 12 through 4 of the sim counter. reading the cop control register returns the reset vector. 5.4.4 power-on reset the power-on reset (por) circuit in the sim clears the sim counter 4096 cgmxclk cycles after power-up. 5.4.5 internal reset an internal reset clears the sim counter and the cop counter. 5.4.6 reset vetor fetch a reset vector fetch occurs when the vector address appears on the data bus. a reset vector fetch clears the sim counter.
non-disclosure agreement required computer operating properly (cop) module advance information mc68hc(9)08pt48 rev. 2.0 106 computer operating properly (cop) module motorola 5.4.7 copd the copd (cop disable) signal refects the state of the cop disable bit (copd) in the mask option register (mor). 5.5 cop control register the cop control register (copctl) is located at address $ffff and overlaps the reset vector. writing any value to $ffff clears the cop counter and starts a new timeout period. reading location $ffff returns the low byte of the reset vector. 5.6 interrupts the cop does not generate cpu interrupt requests or dma service requests. 5.7 monitor mode the cop is disabled in monitor mode when v dd +v hi is present on the irq1/v pp pin or on the rst pin. 5.8 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. address: $ffff bit 7 654321 bit 0 read: low byte of reset vector write: clear cop counter reset: unaffected by reset figure 5-2. cop control register (copctl)
computer operating properly (cop) module cop module during break interrupts mc68hc(9)08pt48 rev. 2.0 advance information motorola computer operating properly (cop) module 107 non-disclosure agreement required 5.8.1 wait mode the cop continues to operate during wait mode. to prevent a cop reset during wait mode, periodically clear the cop counter in a cpu interrupt routine or a dma service routine. 5.8.2 stop mode stop mode turns off the cgmxclk input to the cop and clears the sim counter. service the cop immediately before entering or after exiting stop mode to ensure a full cop timeout period after entering or exiting stop mode. the stop bit in the mask option register (mor) enables the stop instruction. to prevent inadvertently turning off the cop with a stop instruction, disable the stop instruction by programming the stop bits to logic 0. 5.9 cop module during break interrupts the cop is disabled during a break interrupt when v dd =v hi is present on the rst pin.
non-disclosure agreement required computer operating properly (cop) module advance information mc68hc(9)08pt48 rev. 2.0 108 computer operating properly (cop) module motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola keyboard interrupt (kbi) module 109 non-disclosure agreement required advance information mc68hc(9)08pt48 section 6. keyboard interrupt (kbi) module 6.1 contents 6.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 6.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 6.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 6.5 initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 6.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 6.7 kbi during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .114 6.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 6.8.1 keyboard status and control register . . . . . . . . . . . . . . .114 6.8.2 keyboard interrupt enable register . . . . . . . . . . . . . . . . .116 6.2 introduction the keyboard interrupt (kbi) module provides eight independently maskable external interrupt pins. 6.3 features the kbi features include: ? eight keyboard interrupt pins with separate keyboard interrupt enable bits and one keyboard interrupt mask ? hysteresis buffers ? programmable edge-only or edge- and level-interrupt sensitivity ? automatic interrupt acknowledge ? exit from low-power modes
non-disclosure agreement required keyboard interrupt (kbi) module advance information mc68hc(9)08pt48 rev. 2.0 110 keyboard interrupt (kbi) module motorola figure 6-1. kbi block diagram kb0ie kb7ie . . . keyboard interrupt dq ck clr v dd modek imaskk keyboard interrupt ff request vector fetch decoder ackk internal bus reset to pullup kbd7 kbd0 to pullup synchronizer keyf enable enable addr. register name bit 7 6 5 4 3 2 1 bit 0 $0033 keyboard status and control register (kbscr) read: 0 0 0 0 keyf 0 imaskk modek write: ackk reset: 0 0 0 0 0 0 0 0 $0034 keyboard interrupt enable register (kbicr) read: kbie7 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 kbie0 write: reset: 0 0 0 0 0 0 0 0 = unimplemented u = undetermined x = indeterminate figure 6-2. kbi register summary
keyboard interrupt (kbi) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola keyboard interrupt (kbi) module 111 non-disclosure agreement required 6.4 functional description writing to the kbie7Ckbie0 bits in the keyboard interrupt enable register independently enables or disables each port f pin as a keyboard interrupt pin. enabling a keyboard interrupt pin also enables its internal pullup device. a logic 0 applied to an enabled keyboard interrupt pin latches a keyboard interrupt request. a keyboard interrupt request is latched when one or more keyboard pins goes low after all were high. the modek bit in the keyboard status and control register controls the triggering sensitivity of the keyboard interrupt pins. ? if the keyboard interrupt pins are edge-sensitive only, a falling edge on a keyboard pin does not latch an interrupt request if another keyboard pin is already low. to prevent losing an interrupt request on one pin because another pin is still low, software can disable the latter pin while it is low. ? if the keyboard interrupt pins are falling edge- and low level- sensitive, an interrupt request is present as long as any keyboard pin is low. if the modek bit is set, the keyboard interrupt pins are both falling edge- and low level-sensitive, and both of the following actions must occur to clear a keyboard interrupt request: ? vector fetch or software clear a vector fetch generates an interrupt acknowledge signal to clear the interrupt request. software can generate the interrupt acknowledge signal by writing a logic 1 to the ackk bit in the keyboard status and control register. the ackk bit is useful in applications that poll the keyboard interrupt pins and require software to clear the keyboard interrupt request. writing to the ackk bit in an interrupt service routine can also prevent spurious interrupts due to noise. setting ackk does not affect subsequent transitions on the keyboard interrupt pins. a falling edge that occurs after writing to the ackk bit latches another interrupt request. if the keyboard interrupt mask bit, imaskk, is clear, the cpu loads the program counter with the vector address at locations $ffdc and $ffdd.
non-disclosure agreement required keyboard interrupt (kbi) module advance information mc68hc(9)08pt48 rev. 2.0 112 keyboard interrupt (kbi) module motorola ? return of all enabled keyboard interrupt pins to logi c1as long as any enabled keyboard interrupt pin is at logic 0, the keyboard interrupt request remains set. the vector fetch or software clear and the return of all enabled keyboard interrupt pins to logic 1 may occur in any order. if the modek bit is clear, the keyboard interrupt pin is falling-edge sensitive only. with modek clear, a vector fetch or software clear immediately clears the keyboard interrupt request. reset clears the keyboard interrupt request and the modek bit, clearing the interrupt request even if a keyboard interrupt pin stays at logic 0. the keyboard flag bit (keyf) in the keyboard status and control register can be used to see if a pending interrupt exists. the keyf bit is not affected by the keyboard interrupt mask bit (imaskk) which makes it useful in applications where polling is preferred. to determine the logic level on a keyboard interrupt pin, use the data direction register to configure the pin as an input and read the data register. note: setting a keyboard interrupt enable bit (kbxie) forces the corresponding keyboard interrupt pin to be an input, overriding the data direction register. however, the data direction register bit must be a logic 0 for software to read the pin. 6.5 initialization when a keyboard interrupt pin is enabled, it takes time for the internal pullup to reach a logic 1. therefore, a false interrupt can occur as soon as the pin is enabled. to prevent a false interrupt on keyboard initialization: 1. mask keyboard interrupts by setting the imaskk bit in the keyboard status and control register. 2. enable the kbi pins by setting the appropriate kbiex bits in the keyboard interrupt enable register.
keyboard interrupt (kbi) module low-power modes mc68hc(9)08pt48 rev. 2.0 advance information motorola keyboard interrupt (kbi) module 113 non-disclosure agreement required 3. write to the ackk bit in the keyboard status and control register to clear any false interrupts. 4. clear the imaskk bit. an interrupt signal on an edge-triggered pin can be acknowledged immediately after enabling the pin. an interrupt signal on an edge- and level-triggered interrupt pin must be acknowledged after a delay that depends on the external load. another way to avoid a false interrupt: 1. configure the keyboard pins as outputs by setting the appropriate ddrf bits. 2. write logic 1s to the appropriate port f data register bits. 3. enable the kbi pins by setting the appropriate kbiex bits in the keyboard interrupt enable register. 6.6 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 6.6.1 wait mode the keyboard interrupt module remains active in wait mode. clearing the imaskk bit in the keyboard status and control register enables keyboard interrupt requests to bring the mcu out of wait mode. 6.6.2 stop mode the keyboard module remains active in stop mode. clearing the imaskk bit in the keyboard status and control register enables keyboard interrupt requests to bring the mcu out of stop mode.
non-disclosure agreement required keyboard interrupt (kbi) module advance information mc68hc(9)08pt48 rev. 2.0 114 keyboard interrupt (kbi) module motorola 6.7 kbi during break interrupts the bcfe bit in the break flag control register (bfcr) enables software to clear status bits during the break state. (see 7.8.3 sim break flag control register .) to allow software to clear the keyf bit during a break interrupt, write a logic 1 to the bcfe bit. if keyf is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the keyf bit during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0, writing to the keyboard acknowledge bit (ackk) in the keyboard status and control register during the break state has no effect. (see 6.8.1 keyboard status and control register .) 6.8 i/o registers these control and monitor operation of the keyboard interrupt module: ? keyboard status and control register (kbscr) ? keyboard interrupt enable register (kbier) 6.8.1 keyboard status and control register the keyboard status and control register: ? flags keyboard interrupt requests ? acknowledges keyboard interrupt requests ? masks keyboard interrupt requests ? controls keyboard interrupt triggering sensitivity
keyboard interrupt (kbi) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola keyboard interrupt (kbi) module 115 non-disclosure agreement required bits 7C4 not used these read-only bits always read as logic 0s. keyf keyboard flag bit this read-only bit is set when a keyboard interrupt is pending. reset clears the keyf bit. 1 = keyboard interrupt pending 0 = no keyboard interrupt pending ackk keyboard acknowledge bit writing a logic 1 to this write-only bit clears the keyboard interrupt request. ackk always reads as logic 0. reset clears ackk. imaskk keyboard interrupt mask bit writing a logic 1 to this read/write bit prevents the output of the keyboard interrupt mask from generating interrupt requests. reset clears the imaskk bit. 1 = keyboard interrupt requests masked 0 = keyboard interrupt requests not masked modek keyboard triggering sensitivity bit this read/write bit controls the triggering sensitivity of the keyboard interrupt pins. reset clears modek. 1 = keyboard interrupt requests on falling edges and low levels 0 = keyboard interrupt requests on falling edges only address: $0033 bit 7 654321 bit 0 read: 0000 keyf 0 imaskk modek write: ackk reset: 00000000 = unimplemented figure 6-3. keyboard status and control register (kbscr)
non-disclosure agreement required keyboard interrupt (kbi) module advance information mc68hc(9)08pt48 rev. 2.0 116 keyboard interrupt (kbi) module motorola 6.8.2 keyboard interrupt enable register the keyboard interrupt enable register enables or disables each port f pin to operate as a keyboard interrupt pin. kbie7Ckbie0 keyboard interrupt enable bits each of these read/write bits enables the corresponding keyboard interrupt pin to latch interrupt requests. reset clears the keyboard interrupt enable register. 1 = pfx pin enabled as keyboard interrupt pin 0 = pfx pin not enabled as keyboard interrupt pin address: $0034 bit 7 654321 bit 0 read: kbie7 kbie6 kbie5 kbie4 kbie3 kbie2 kbie1 kbie0 write: reset: 00000000 figure 6-4. keyboard interrupt enable register (kbier)
mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 117 non-disclosure agreement required advance information mc68hc(9)08pt48 section 7. system integration module (sim) 7.1 contents 7.1 contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 7.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 7.3 sim bus clock control and generation . . . . . . . . . . . . . . . . .121 7.3.1 bus timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121 7.3.2 clock start-up from por or lvi reset . . . . . . . . . . . . . . .121 7.3.3 clocks in stop mode and wait mode . . . . . . . . . . . . . . . .122 7.4 reset and system initialization. . . . . . . . . . . . . . . . . . . . . . . .122 7.4.1 external pin reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 7.4.2 active resets from internal sources . . . . . . . . . . . . . . . . .124 7.4.2.1 power-on reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 7.4.2.2 computer operating properly (cop) reset. . . . . . . . . .126 7.4.2.3 illegal opcode reset . . . . . . . . . . . . . . . . . . . . . . . . . . .126 7.4.2.4 illegal address reset . . . . . . . . . . . . . . . . . . . . . . . . . . .126 7.4.2.5 low-voltage inhibit (lvi) reset . . . . . . . . . . . . . . . . . . .127 7.5 sim counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 7.5.1 sim counter during power-on reset . . . . . . . . . . . . . . . .127 7.5.2 sim counter during stop mode recovery . . . . . . . . . . . .128 7.5.3 sim counter and reset states . . . . . . . . . . . . . . . . . . . . .128 7.6 exception control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128 7.6.1 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 7.6.1.1 hardware interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . .131 7.6.1.2 swi instruction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.2 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.3 break interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132 7.6.4 status flag protection in break mode. . . . . . . . . . . . . . . .132 7.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133 7.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133 7.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 118 system integration module (sim) motorola 7.8 sim registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136 7.8.1 sim break status register . . . . . . . . . . . . . . . . . . . . . . . .136 7.8.2 sim reset status register . . . . . . . . . . . . . . . . . . . . . . . .138 7.8.3 sim break flag control register . . . . . . . . . . . . . . . . . . .139 7.2 introduction this section describes the system integration module (sim24, version e), which supports up to 24 external and/or internal interrupts. together with the cpu, the sim controls all mcu activities. a block diagram of the sim is shown in figure 7-1 . figure 7-2 is a summary of the sim input/output (i/o) registers. the sim is a system state controller that coordinates cpu and exception timing. the sim is responsible for: ? controlling mode selection ? bus clock generation and control for cpu and peripherals C stop/wait/reset/break entry and recovery C internal clock control ? master reset control, including power-on reset (por) and cop timeout ? interrupt control: C acknowledge timing C arbitration control timing C vector address generation ? cpu clock control with dma transfer and low-power modes ? slow memory read/write timing ? cpu enable/disable timing ? modular architecture expandable to 128 interrupt sources note: all references to lvi and dma operation in this section should be ignored. table 7-1 shows the internal signal names used in this section.
system integration module (sim) introduction mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 119 non-disclosure agreement required figure 7-1. sim block diagram stop/wait clock control clock generators por control reset pin control sim reset status register interrupt control and priority decode module stop module wait cpu stop (from cpu) cpu wait (from cpu) simoscen (to cgm) cgmout (from cgm) internal clocks master reset control reset pin logic lvi (from lvi module) illegal opcode (from cpu) illegal address (from address map decoders) cop (from cop module) interrupt sources cpu interface reset control sim counter cop clock cgmxclk (from cgm) ? 2
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 120 system integration module (sim) motorola addr. register name bit 7 6 5 4 3 2 1 bit 0 $fe00 sim break status register (sbsr) read: rr r r r r sbsw r write: note 1 reset: 0 note 1. writing a logic 0 clears sbsw. $fe01 sim reset status register (srsr) read: por pin cop ilop ilad 0 lvi 0 write: reset: 1 0 0 0 0 0 0 0 $fe03 sim break flag control register (sbfcr) read: bcfe r r r r r r r write: reset: 0 r = reserved = unimplemented figure 7-2. sim i/o register summary table 7-1. signal name conventions signal name description cgmxclk buffered version of osc1 from clock generator module (cgm) cgmvclk pll output cgmout pll-based or osc1-based clock output from cgm module (bus clock = cgmout divided by two) iab internal address bus idb internal data bus porrst signal from the power-on reset module to the sim irst internal reset signal r/ w read/write signal
system integration module (sim) sim bus clock control and generation mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 121 non-disclosure agreement required 7.3 sim bus clock control and generation the bus clock generator provides system clock signals for the cpu and peripherals on the mcu. the system clocks are generated from an incoming clock, cgmout, as shown in figure 7-3 . this clock can come from either an external oscillator or from the on-chip pll. for additional information, refer to section 4. clock generator module (cgmb) . figure 7-3. cgm clock signals 7.3.1 bus timing in user mode , the internal bus frequency is either the crystal oscillator output (cgmxclk) divided by four or the pll output (cgmvclk) divided by four. for additional information, refer to section 4. clock generator module (cgmb) . 7.3.2 clock startup from por or lvi reset when the power-on reset (por) module or the low-voltage inhibit (lvi) module generates a reset, the clocks to the cpu and peripherals are inactive and held in an inactive phase until after the 4096 cgmxclk cycle por timeout has completed. the rst pin is driven low by the sim during this entire period. the ibus clocks start upon completion of the timeout. pll osc1 cgmxclk ? 2 bus clock generators sim cgm sim counter ptc3 monitor mode clock select circuit cgmvclk bcs ? 2 a b s* cgmout *when s = 1, cgmout = b user mode
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 122 system integration module (sim) motorola 7.3.3 clocks in stop mode and wait mode upon exit from stop mode (by an interrupt, break, or reset), the sim allows cgmxclk to clock the sim counter. the cpu and peripheral clocks do not become active until after the stop delay timeout. this timeout is selectable as 4096 or 32 cgmxclk cycles. (see 7.7.2 stop mode .) in wait mode, the cpu clocks are inactive. the sim also produces two sets of clocks for other modules. refer to the wait mode subsection of each module to see if the module is active or inactive in wait mode. some modules can be programmed to be active in wait mode. 7.4 reset and system initialization the mcu has the following reset sources: ? power-on reset module (por) ? external reset pin ( rst) ? computer operating properly module (cop) ? low-voltage inhibit module (lvi) ? illegal opcode ? illegal address all of these resets produce the vector $fffeCffff ($fefeCfeff in monitor mode) and assert the internal reset signal (irst). irst causes all registers to be returned to their default values and all modules to be returned to their reset states. an internal reset clears the sim counter (see 7.5 sim counter ), but an external reset does not. each of the resets sets a corresponding bit in the sim reset status register (srsr). (see 7.8 sim registers .)
system integration module (sim) reset and system initialization mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 123 non-disclosure agreement required 7.4.1 external pin reset pulling the asynchronous rst pin low halts all processing. the pin bit of the sim reset status register (srsr) is set as long as rst is held low for a minimum of 67 cgmxclk cycles, assuming that neither the por nor the lvi was the source of the reset. see table 7-2 for details. figure 7-4 shows the relative timing. figure 7-4. external reset timing table 7-2. pin bit set timing reset type number of cycles required to set pin por/lvi 4163 (4096 + 64 + 3) all others 67 (64 + 3) rst iab pc vect h vect l cgmout
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 124 system integration module (sim) motorola 7.4.2 active resets from internal sources all internal reset sources actively pull the rst pin low for 32 cgmxclk cycles to allow resetting of external peripherals. the internal reset signal irst continues to be asserted for an additional 32 cycles. (see figure 7-5 .) an internal reset can be caused by an illegal address, illegal opcode, cop timeout, module reset, lvi, or por. (see figure 7-6 .) note: for lvi or por resets, the sim cycles through 4096 cgmxclk cycles during which the sim forces the rst pin low. the internal reset signal then follows the sequence from the falling edge of rst shown in figure 7-5 . figure 7-5. internal reset timing the cop reset is asynchronous to the bus clock. figure 7-6. sources of internal reset the active reset feature allows the part to issue a reset to peripherals and other chips within a system built around the mcu. irst rst rst pulled low by mcu iab 32 cycles 32 cycles vector high cgmxclk illegal address rst illegal opcode rst coprst lvi por internal reset
system integration module (sim) reset and system initialization mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 125 non-disclosure agreement required 7.4.2.1 power-on reset when power is first applied to the mcu, the power-on reset module (por) generates a pulse to indicate that power-on has occurred. the external reset pin ( rst) is held low while the sim counter counts out 4096 cgmxclk cycles. sixty-four cgmxclk cycles later, the cpu and memories are released from reset to allow the reset vector sequence to occur. at power-on, the following events occur: ? a por pulse is generated. ? the internal reset signal is asserted. ? the sim enables cgmout. ? internal clocks to the cpu and modules are held inactive for 4096 cgmxclk cycles to allow stabilization of the oscillator. ? the rst pin is driven low during the oscillator stabilization time. ? the por bit of the sim reset status register (srsr) is set and all other bits in the register are cleared. figure 7-7. por recovery porrst osc1 cgmxclk cgmout rst iab 4096 cycles 32 cycles 32 cycles $fffe $ffff
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 126 system integration module (sim) motorola 7.4.2.2 computer operating properly (cop) reset an input to the sim is reserved for the cop reset signal. the overflow of the cop counter causes an internal reset and sets the cop bit in the sim reset status register (srsr). the sim actively pulls down the rst pin for all internal reset sources. to prevent a cop module timeout, write any value to location $ffff. writing to location $ffff clears the cop counter and bits 12 through 4 of the sim counter. the sim counter output, which occurs at least every 2 13 C2 4 cgmxclk cycles, drives the cop counter. the cop should be serviced as soon as possible out of reset to guarantee the maximum amount of time before the first timeout. the cop module is disabled if the rst pin or the irq1/v pp pin is held at v dd +v hi while the mcu is in monitor mode. the cop module can be disabled only through combinational logic conditioned with the high voltage signal on the rst or the irq1/v pp pin. this prevents the cop from becoming disabled as a result of external noise. during a break state, v dd +v hi on the rst pin disables the cop module. 7.4.2.3 illegal opcode reset the sim decodes signals from the cpu to detect illegal instructions. an illegal instruction sets the ilop bit in the sim reset status register (srsr) and causes a reset. if the stop enable bit, stop, in the mask option register is logic 0, the sim treats the stop instruction as an illegal opcode and causes an illegal opcode reset. the sim actively pulls down the rst pin for all internal reset sources. 7.4.2.4 illegal address reset an opcode fetch from an unmapped address generates an illegal address reset. the sim verifies that the cpu is fetching an opcode prior to asserting the ilad bit in the sim reset status register (srsr) and resetting the mcu. a data fetch from an unmapped address does not generate a reset. the sim actively pulls down the rst pin for all internal reset sources.
system integration module (sim) sim counter mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 127 non-disclosure agreement required 7.4.2.5 low-voltage inhibit (lvi) reset the low-voltage inhibit module (lvi) asserts its output to the sim when the v dd voltage falls to the lvi tripf voltage. the lvi bit in the sim reset status register (srsr) is set and the external reset pin ( rst) is held low while the sim counter counts out 4096 cgmxclk cycles. sixty-four cgmxclk cycles later, the cpu is released from reset to allow the reset vector sequence to occur. the sim actively pulls down the rst pin for all internal reset sources. 7.5 sim counter the sim counter is used by the power-on reset module (por) and in stop mode recovery to allow the oscillator time to stabilize before enabling the internal bus (ibus) clocks. reset recovery control logic and real time interrupt models also use taps from the sim counter. the sim counter also serves as a prescaler for the computer operating properly module (cop). the sim counter overflow supplies the clock for the cop module. the sim counter is 13 bits long and is clocked by the falling edge of cgmxclk. 7.5.1 sim counter during power-on reset the power-on reset module (por) detects power applied to the mcu. at power-on, the por circuit asserts the signal porrst. once the sim is initialized, it enables the clock generation module (cgm) to drive the bus clock state machine.
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 128 system integration module (sim) motorola 7.5.2 sim counter during stop mode recovery the sim counter also is used for stop mode recovery. the stop instruction clears the sim counter. after an interrupt, break, or reset, the sim senses the state of the short stop recovery bit, ssrec, in the mask option register. if the ssrec bit is a logic one, then the stop recovery is reduced from the normal delay of 4096 cgmxclk cycles down to 32 cgmxclk cycles. this is ideal for applications using canned oscillators that do not require long startup times from stop mode. external crystal applications should use the full stop recovery time, that is, with ssrec cleared (grounded). 7.5.3 sim counter and reset states external reset has no effect on the sim counter. (see 7.7.2 stop mode for details.) the sim counter is free-running after all reset states. (see 7.4.2 active resets from internal sources for counter control and internal reset recovery sequences.) 7.6 exception control normal, sequential program execution can be changed in three different ways: ? interrupts C maskable hardware cpu interrupts C non-maskable software interrupt instruction (swi) ? reset ? break interrupts
system integration module (sim) exception control mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 129 non-disclosure agreement required 7.6.1 interrupts at the beginning of an interrupt, the cpu saves the cpu register contents on the stack and sets the interrupt mask (i bit) to prevent additional interrupts. at the end of an interrupt, the rti instruction recovers the cpu register contents from the stack so that normal processing can resume. figure 7-8 shows interrupt entry timing. figure 7-9 shows interrupt recovery timing. interrupts are latched and arbitration is performed in the sim at the start of interrupt processing. the arbitration result is a constant that the cpu uses to determine which vector to fetch. once an interrupt is latched by the sim, no other interrupt may take precedence, regardless of priority, until the latched interrupt is serviced (or the i bit is cleared). (see figure 7-10 .) figure 7-8 . interrupt entry figure 7-9. interrupt recovery module idb r/ w interrupt dummy sp sp C 1 sp C 2 sp C 3 sp C 4 vect h vect l start addr iab dummy pc C 1[7:0] pc C 1[15:8] x a ccr v data h v data l opcode i bit module idb r/ w interrupt sp C 4 sp C 3 sp C 2 sp C 1 sp pc pc + 1 iab ccr a x pc C 1[7:0] pc C 1[15:8] opcode operand i bit
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 130 system integration module (sim) motorola figure 7-10. interrupt processing no no no yes no no yes no yes yes as many interrupts as exist on chip i bit set? from reset break interrupt? i bit set? irq0 interrupt? irq1 interrupt? swi instruction? rti instruction? fetch next instruction unstack cpu registers stack cpu registers set i bit load pc with interrupt vector execute instruction yes yes
system integration module (sim) exception control mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 131 non-disclosure agreement required 7.6.1.1 hardware interrupts a hardware interrupt does not stop the current instruction. processing of a hardware interrupt begins after completion of the current instruction. when the current instruction is complete, the sim checks all pending hardware interrupts. if interrupts are not masked (i bit clear in the condition code register), and if the corresponding interrupt enable bit is set, the sim proceeds with interrupt processing; otherwise, the next instruction is fetched and executed. if more than one interrupt is pending at the end of an instruction execution, the highest priority interrupt is serviced first. figure 7-11 demonstrates what happens when two interrupts are pending. if an interrupt is pending upon exit from the original interrupt service routine, the pending interrupt is serviced before the lda instruction is executed. figure 7-11 . interrupt recognition example the lda opcode is prefetched by both the int1 and int2 rti instructions. however, in the case of the int1 rti prefetch, this is a redundant operation. note: to maintain compatibility with the m6805 family, the h register is not pushed on the stack during interrupt entry. if the interrupt service routine cli lda int1 pulh rti int2 background #$ff pshh int1 interrupt service routine pulh rti pshh int2 interrupt service routine routine
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 132 system integration module (sim) motorola modifies the h register or uses the indexed addressing mode, software should save the h register and then restore it prior to exiting the routine. 7.6.1.2 swi instruction the swi instruction is a non-maskable instruction that causes an interrupt regardless of the state of the interrupt mask (i bit) in the condition code register. note: a software interrupt pushes pc onto the stack. a software interrupt does not push pc C 1, as a hardware interrupt does. 7.6.2 reset all reset sources always have equal and highest priority and cannot be arbitrated. 7.6.3 break interrupts the break module can stop normal program flow at a software- programmable break point by asserting its break interrupt output. (see section 19. break module .) the sim puts the cpu into the break state by forcing it to the swi vector location. refer to the break interrupt subsection of each module to see how each module is affected by the break state. 7.6.4 status flag protection in break mode the sim controls whether status flags contained in other modules can be cleared during break mode. the user can select whether flags are protected from being cleared by properly initializing the break clear flag enable bit (bcfe) in the sim break flag control register (sbfcr). protecting flags in break mode ensures that set flags will not be cleared while in break mode. this protection allows registers to be freely read and written during break mode without losing status flag information.
system integration module (sim) low-power modes mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 133 non-disclosure agreement required setting the bcfe bit enables the clearing mechanisms. once cleared in break mode, a flag remains cleared even when break mode is exited. status flags with a 2-step clearing mechanism for example, a read of one register followed by the read or write of another are protected, even when the first step is accomplished prior to entering break mode. upon leaving break mode, execution of the second step will clear the flag as normal. 7.7 low-power modes executing the wait or stop instruction puts the mcu in a low power- consumption mode for standby situations. the sim holds the cpu in a non-clocked state. the operation of each of these modes is described in the subsections that follow. both stop and wait clear the interrupt mask (i) in the condition code register, allowing interrupts to occur. 7.7.1 wait mode in wait mode, the cpu clocks are inactive while the peripheral clocks continue to run. figure 7-12 shows the timing for wait mode entry. figure 7-12. wait mode entry timing a module that is active during wait mode can wake up the cpu with an interrupt if the interrupt is enabled. stacking for the interrupt begins one cycle after the wait instruction during which the interrupt occurred. in wait mode, the cpu clocks are inactive. refer to the wait mode subsection of each module to see if the module is active or inactive in wait addr + 1 same same iab idb previous data next opcode same wait addr same r/ w note: previous data can be operand data or the wait opcode, depending on the last instruction.
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 134 system integration module (sim) motorola wait mode. some modules can be programmed to be active in wait mode. wait mode can also be exited by a reset or break. a break interrupt during wait mode sets the sim break stop/wait bit, sbsw, in the sim break status register (sbsr). if the cop disable bit, copd, in the mask option register is logic 0, then the computer operating properly module (cop) is enabled and remains active in wait mode. figure 7-13 and figure 7-14 show the timing for wait recovery. figure 7-13. wait recovery from interrupt or break figure 7-14. wait recovery from internal reset $6e0c $6e0b $00ff $00fe $00fd $00fc $a6 $a6 $01 $0b $6e $a6 iab idb exitstopwait note: exitstopwait = rst pin or cpu interrupt or break interrupt iab idb rst $a6 $a6 $6e0b rst vct h rst vct l $a6 cgmxclk 32 cycles 32 cycles
system integration module (sim) low-power modes mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 135 non-disclosure agreement required 7.7.2 stop mode in stop mode, the sim counter is reset and the system clocks are disabled. an interrupt request from a module can cause an exit from stop mode. stacking for interrupts begins after the selected stop recovery time has elapsed. reset or break also causes an exit from stop mode. the sim disables the clock generator module outputs (cgmout and cgmxclk) in stop mode, stopping the cpu and peripherals. stop recovery time is selectable using the ssrec bit in the mask option register (mor). if ssrec is set, stop recovery is reduced from the normal delay of 4096 cgmxclk cycles down to 32. this is ideal for applications using canned oscillators that do not require long start-up times from stop mode. note: external crystal applications should use the full stop recovery time by clearing the ssrec bit. a break interrupt during stop mode sets the sim break stop/wait bit (sbsw) in the sim break status register (sbsr). the sim counter is held in reset from the execution of the stop instruction until the beginning of stop recovery. it is then used to time the recovery period. figure 7-15 shows stop mode entry timing and figure 7-16 shows stop mode recovery timing from interrupt or break. figure 7-15. stop mode entry timing stop addr + 1 same same iab idb previous data next opcode same stop addr same r/ w cpustop note: previous data can be operand data or the stop opcode, depending on the last instruction.
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 136 system integration module (sim) motorola figure 7-16. stop mode recovery from interrupt or break 7.8 sim registers the sim has three memory mapped registers. table 7-3 shows the mapping of these registers. 7.8.1 sim break status register the sim break status register contains a flag to indicate that a break caused an exit from stop or wait mode. cgmxclk int/break iab stop + 2 stop + 2 sp sp C 1 sp C 2 sp C 3 stop +1 stop recovery period table 7-3. sim registers address register access mode $fe00 sbsr user $fe01 srsr user $fe03 sbfcr user address: $fe00 bit 7 654321 bit 0 read: rrrrrr sbsw r write: note 1 reset: 0 r = reserved note 1. writing a logic 0 clears sbsw. figure 7-17. sim break status register (sbsr)
system integration module (sim) sim registers mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 137 non-disclosure agreement required sbsw sim break stop/wait this status bit is useful in applications requiring a return to wait or stop mode after exiting from a break interrupt. clear sbsw by writing a logic 0 to it. reset clears sbsw. 1 = stop mode or wait mode was exited by break interrupt 0 = stop mode or wait mode was not exited by break interrupt sbsw can be read within the break state swi routine. the user can modify the return address on the stack by subtracting one from it. the following code is an example of this. writing 0 to the sbsw bit clears it. ; ; ; this code works if the h register has been pushed onto the stack in the break service routine software. this code should be executed at the end of the break service routine software. hibyte equ 5 lobyte equ 6 ; if not sbsw, do rti brclr sbsw,sbsr, return ; ; see if wait mode or stop mode was exited by break. tst lobyte,sp ; if returnlo is not zero, bne dolo ; then just decrement low byte. dec hibyte,sp ; else deal with high byte, too. dolo dec lobyte,sp ; point to wait/stop opcode. return pulh rti ; restore h register.
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 138 system integration module (sim) motorola 7.8.2 sim reset status register this register contains six flags that show the source of the last reset. clear the sim reset status register by reading it. a power-on reset sets the por bit and clears all other bits in the register. por power-on reset bit 1 = last reset caused by por circuit 0 = read of srsr pin external reset bit 1 = last reset caused by external reset pin ( rst) 0 = por or read of srsr cop computer operating properly reset bit 1 = last reset caused by cop counter 0 = por or read of srsr ilop illegal opcode reset bit 1 = last reset caused by an illegal opcode 0 = por or read of srsr ilad illegal address reset bit (opcode fetches only) 1 = last reset caused by an opcode fetch from an illegal address 0 = por or read of srsr mod module reset bit 1 = last reset caused by one of the internal modules 0 = por or read of srsr address: $fe01 bit 7 654321 bit 0 read: por pin cop ilop ilad 0 lvi 0 write: reset: 10000000 = unimplemented figure 7-18. sim reset status register (srsr)
system integration module (sim) sim registers mc68hc(9)08pt48 rev. 2.0 advance information motorola system integration module (sim) 139 non-disclosure agreement required lvi low-voltage inhibit reset bit 1 = last reset was caused by the lvi circuit 0 = por or read of srsr 7.8.3 sim break flag control register the sim break control register (sbfcr) contains a bit that enables software to clear status bits while the mcu is in a break state. bcfe break clear flag enable bit this read/write bit enables software to clear status bits by accessing status registers while the mcu is in a break state. to clear status bits during the break state, the bcfe bit must be set. 1 = status bits clearable during break 0 = status bits not clearable during break address: $fe03 bit 7 654321 bit 0 read: bcfe rrrrrrr write: reset:: 0 r = reserved figure 7-19. sim break flag control register (sbfcr)
non-disclosure agreement required system integration module (sim) advance information mc68hc(9)08pt48 rev. 2.0 140 system integration module (sim) motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola random-access memory (ram) 141 non-disclosure agreement required advance information mc68hc(9)08pt48 section 8. random-access memory (ram) 8.1 contents 8.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 8.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 8.2 introduction this section describes the 2.5 kbytes of ram. 8.3 functional description addresses $0050 through $0a4f are ram locations. the location of the stack ram is programmable. the 16-bit stack pointer allows the stack to be anywhere in the 64-kbyte memory space. note: for correct operation, the stack pointer must point only to ram locations. within page zero are 176 bytes of ram. because the location of the stack ram is programmable, all page zero ram locations can be used for i/o (input/output) control and user data or code. when the stack pointer is moved from its reset location at $00ff, direct addressing mode instructions can access efficiently all page zero ram locations. page zero ram, therefore, provides ideal locations for frequently accessed global variables. before processing an interrupt, the cpu uses 5 bytes of the stack to save the contents of the cpu registers. note: for m6805 compatibility, the h register is not stacked.
non-disclosure agreement required random-access memory (ram) advance information mc68hc(9)08pt48 rev. 2.0 142 random-access memory (ram) motorola during a subroutine call, the cpu uses 2 bytes of the stack to store the return address. the stack pointer decrements during pushes and increments during pulls. note: be careful when using nested subroutines. the cpu may overwrite data in the ram during a subroutine or during the interrupt stacking operation.
mc68hc(9)08pt48 rev. 2.0 advance information motorola 2-kbyte flash memory 143 non-disclosure agreement required advance information mc68hc(9)08pt48 section 9. 2-kbyte flash memory 9.1 contents 9.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 9.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144 9.4 flash 3 control register . . . . . . . . . . . . . . . . . . . . . . . . . . .145 9.5 flash 3 block protect register. . . . . . . . . . . . . . . . . . . . . . .147 9.6 block protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 9.7 charge pump frequency control . . . . . . . . . . . . . . . . . . . . . .148 9.8 flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149 9.9 flash program and margin read operation . . . . . . . . . . . .150 9.2 introduction this section describes the operation of the embedded 2-kbyte flash memory. this is non-volatile memory which can be read, programmed, and erased from a single external supply.
non-disclosure agreement required 2-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 144 2-kbyte flash memory motorola 9.3 functional description this flash memory array contains 2,048 bytes. an erased bit reads as a logic 0 and a programmed bit reads as a logic 1. program and erase operations are facilitated through control bits in a memory mapped register. details for these operations appear later in this section. memory in the flash array is organized into pages and rows. there are eight pages of memory per row and for this array, 1 byte per page. the minimum erase block size is a single row, eight bytes. programming is performed on a per page basis, or for this array, one byte at a time. the address ranges for the 2-kbyte flash memory are: ? $1800C$1fff; general-purpose flash array when programming the flash, just enough program time must be utilized via an iterative programming algorithm. too much program time can result in a disturb condition in which an erased bit becomes programmed. this can be prevented as long as no more than eight program operations are performed per row before again performing an erase operation. each programmed page is read in margin mode to ensure that the bits are programmed enough for data retention over device lifetime. the row architecture for this array is: ? $1800C$1807; row 0 ? $1808C$180f; row 1 ? $1810C$1817; row 2 ? ---------------------------- ? $1ff8C$1fff; row 255
2-kbyte flash memory flash 3 control register mc68hc(9)08pt48 rev. 2.0 advance information motorola 2-kbyte flash memory 145 non-disclosure agreement required 9.4 flash 3 control register the flash control register (fl3cr) controls flash program, erase, and margin operations. note: devices with more than one flash have multiple control registers (flcrs). only one flash control register should be accessed at a time, so while accessing one control register, ensure that any others are cleared. f3div0 frequency divide control bit this bit selects the factor by which cgmvclk is divided to derive the charge pump frequency. see table 9-2 . note that f3div1 has no effect. f3blk1 and f3blk0 block erase control bits these bits control erasing of blocks of varying size. table 9-1 shows the various block sizes which can be erased in one erase operation. address: $fe08 bit 7 654321 bit 0 read: f3div1 f3div0 f3blk1 f3blk0 hven marg erase pgm write: reset: 00000000 figure 9-1. flash 3 control register (fl3cr) table 9-1. erase block sizes blk1 blk0 block size row boundaries 0 0 full array: 2 kbytes 0C255($1800C$1fff) 0 1 one-half array: 1 kbyte 0C127($1800C$1bff) 128C255($1c00C$1fff 1 0 eight rows: 64 bytes 0C7($1800C$183f) 8C15($1840C$187f) 16C23($1880C$18bf) --- 248C255($1fc0C$1fff) 1 1 single row: 8 bytes 0($1800C$1807) 1($1808C$180f) ---- 255($1ff8C$1fff)
non-disclosure agreement required 2-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 146 2-kbyte flash memory motorola in step 4 of the erase operation in section 9.8 flash erase operation , the upper addresses are latched and used to determine the location of the block to be erased. for the full array, the only requirement is that the target address points to any byte in this array. writing to any address in the array will enable the erase. hven high-voltage enable bit this read/write bit enables high voltage from the charge pump to the memory for either program or erase operation. it can only be set if either pgm or erase is set. 1 = high voltage enabled to array and charge pump on 0 = high voltage disabled to array and charge pump off marg program margin control bit this read/write bit configures the memory for a program margin operation. it cannot be set if the hven bit is set, and if it is set when hven is set, it will automatically return to 0. 1 = margin operation selected 0 = margin operation unselected erase erase control bit this read/write bit configures the memory for erase operation. it is interlocked with the pgm bit such that both bits cannot be set to 1 at the same time. 1 = erase operation selected 0 = erase operation unselected pgm program control bit this read/write bit configures the memory for program operation. it is interlocked with the erase bit such that both bits cannot be equal to 1 or set to 1 at the same time. 1 = program operation selected 0 = program operation unselected
2-kbyte flash memory flash 3 block protect register mc68hc(9)08pt48 rev. 2.0 advance information motorola 2-kbyte flash memory 147 non-disclosure agreement required 9.5 flash 3 block protect register the block protect register (fl3bpr) is implemented as an input/output (i/o) register. each bit, when programmed, protects a range of addresses in the flash. bpr3 block protect register bit 3 this bit protects the memory contents in the address range $1c00 to $1fff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr2 block protect register bit 2 this bit protects the memory contents in the address range $1a00 to $1fff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr1 block protect register bit 1 this bit protects the memory contents in the address range $1900 to $1fff. 1 = address range protected from erase or program 0 = address range open to erase or program bpr0 block protect register bit 0 this bit protects the memory contents in the address range $1800 to $1fff. 1 = address range protected from erase or program 0 = address range open to erase or program address: $001e bit 7 654321 bit 0 read: write: bpr3 bpr2 bpr1 bpr0 reset: x x x x 1111 = unimplemented x = indeterminate figure 9-2. flash 3 block protect register (fl3bpr)
non-disclosure agreement required 2-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 148 2-kbyte flash memory motorola by programming the block protect bits, a portion of the memory will be locked so that no further erase or program operations may be performed. programming more than one bit at a time is redundant. if both bpr3 and bpr2 are set, for instance, the address range $1a00 through $1fff is locked. if all bits are cleared, then all of the memory is available for erase and program. 9.6 block protection because of the ability of the on-board charge pump to erase and program the flash memory in the target application, provision is made for protecting blocks of memory from unintentional erase or program operations. this protection is done by reserving a location in the i/o space for block protect information. if the address range for an erase or program operation includes a protected block, the pgm or erase bit is cleared which prevents the hven bit in the flash control register from being set so that no high voltage is allowed in the array. when the block protect register is cleared, the entire memory is accessible for program and erase. when bits within the register are programmed, they lock blocks of memory address ranges as shown in the 9.5 flash 3 block protect register . 9.7 charge pump frequency control the internal charge pump for this array is to be operated over the specified frequency range (refer to 22.16 2-k flash memory electrical characteristics ). the pll output clock, cgmvclk, is used to derive the two quadrature clocks, vclk12 and vclk23 which are one-half cgmvclk. additional pump frequency control is provided using the fdiv0 bit to keep the vclks within the specified range. the pll must be on and locked (but not necessarily engaged) before program/erase operations can be performed. see table 9-2 .
2-kbyte flash memory flash erase operation mc68hc(9)08pt48 rev. 2.0 advance information motorola 2-kbyte flash memory 149 non-disclosure agreement required . 9.8 flash erase operation note: after a total of eight program operations have been applied to a row, the row must be erased before further use to avoid the disturb condition. an erased byte will read $00. 22.16 2-k flash memory electrical characteristics has a detailed description of the times used in this algorithm. use this step-by-step procedure to erase a block of flash memory: 1. establish pump frequency by configuring pll. 2. unprotect target portion of the array (bpr0Cbpr3.) 3. set the erase bit, the blk0, blk1, and fdiv0 bit in the flash control register. 4. write to any flash address with any data within the block address range desired. 5. set the hven bit. 6. wait for a time, t erase . 7. clear the hven bit. 8. wait for a time, t kill , for the high voltages to dissipate. 9. clear the erase bit. 10. after time, t hvd , the memory can be accessed again in read mode. note: these operations must be performed in the order as shown, but other unrelated operations may occur between the steps. do not exceed t erase maximum. table 9-2. charge pump clock frequency fdiv0 pump clock frequency 0 cgmvclk ? 2 1 cgmvclk ? 4
non-disclosure agreement required 2-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 150 2-kbyte flash memory motorola 9.9 flash program and margin read operation programming of this flash array is done on a page basis where one page equals one byte. the purpose of the margin read mode is to ensure that data has been programmed with sufficient margin for long-term data retention. during a margin read, the control gates of the selected memory bits are held at a slightly negative voltage by an internal charge pump. reading the data in margin mode is the same as for ordinary read mode except that a built-in counter stretches the data access for an additional eight cycles to allow sensing of the lower cell current. in short, a margin read applies a more stringent condition on the bitcell during read which ensures the data will be valid throughout the life of the product. a margin read can only follow a program operation. all times listed here are specified in section 22. electrical specifications . the procedure for programming the flash memory is: 1. establish pump frequency by configuring the pll. 2. set the pgm bit and program fdiv0 to the appropriate value. this configures the memory for program operation and enables the latching of address and data for programming. 3. write data to the page (1 byte) being programmed. 4. set the hven bit. 5. wait for a time, t step . 6. clear the hven bit. 7. wait for a time, t hvtv. 8. set the marg bit. 9. wait for a time, t vtp. 10. clear the pgm bit. 11. wait for a time, t hvd . 12. read the page of data. (this is in margin mode.) 13. clear the marg bit. 14. if any programmed bits do not read correctly, repeat the process from step 2 through 13 up to maximum program pulses. (see 22.16 2-k flash memory electrical characteristics .)
2-kbyte flash memory flash program and margin read operation mc68hc(9)08pt48 rev. 2.0 advance information motorola 2-kbyte flash memory 151 non-disclosure agreement required figure 9-3. page program algorithm program 2-k flash initialize attempt set pgm bit and fdiv bits wait t hvtv wait t vtp set hven bit clear pgm bit set margin bit wait t hvd increment attempt yes no counter to 0 yes no programming operation failed programming operation complete write data to selected page wait t step clear hven bit read page of data clear margin bit read data equal to write data? attempt count equal to 5? note: this page program algorithm assumes the pll is on and locked and the page in question has been erased before entry. counter
non-disclosure agreement required 2-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 152 2-kbyte flash memory motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 153 non-disclosure agreement required advance information mc68hc(9)08pt48 section 10. 48-kbyte flash memory 10.1 contents 10.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153 10.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154 10.4 flash 1control register . . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10.5 flash 2 control register . . . . . . . . . . . . . . . . . . . . . . . . . . .155 10.6 flash 1 block protect register. . . . . . . . . . . . . . . . . . . . . . .158 10.7 flash 2 block protect register. . . . . . . . . . . . . . . . . . . . . . .159 10.8 block protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 10.9 charge pump frequency control . . . . . . . . . . . . . . . . . . . . . .161 10.10 flash erase operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 10.11 flash program and margin read operation . . . . . . . . . . . .162 10.2 introduction this section describes the operation of the embedded 48-kbyte flash memory. this is non-volatile memory which can be read, programmed, and erased from a single external supply.
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 154 48-kbyte flash memory motorola 10.3 functional description the flash memory contains 48,676 bytes divided between two flash arrays. an erased bit reads as a logic 0 and a programmed bit reads as a logic 1. program and erase operations are facilitated through control bits in a memory mapped register. details for these operations appear later in this section. memory in the flash array is organized into pages and rows. there are eight pages of memory per row and for this array, 8 bytes per page. the minimum erase block size is a single row, 64 bytes. programming is performed on a per page basis, or for this array, eight bytes at a time. the address ranges for the 48-kbyte flash memory are: ? $4000C$7fff; flash 2 array ? $8000C$fdff; flash 1 array ? $ffd4C$ffff; user vector space and part of flash 1 array when programming the flash, just enough program time must be utilized via an iterative programming algorithm. too much program time can result in a disturb condition in which an erased bit becomes programmed. this can be prevented as long as no more than eight program operations are performed per row before again performing an erase operation. each programmed page is read in margin mode to ensure that the bits are programmed enough for data retention over device lifetime. the row architecture for this array is: ? $8000C$803f; row 0 of flash 1 ? $8040C$807f; row 1 of flash 1 ? $8080C$80cf; row 2 of flash 1 ? ---------------------------------------- ? $ffc0C$ffff; row 511 of flash 1 ? $4000C$403f; row 0 of flash 2 ? $4040C$407f; row 1 of flash 2 ? $4080C$40bf; row 2 of flash 2 ? ---------------------------------------- ? $7fc0C$7fff; row 255 of flash 2
48-kbyte flash memory flash 1control register mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 155 non-disclosure agreement required 10.4 flash 1 control register the flash 1 control register (fl1cr) controls flash program, erase, and margin operations. 10.5 flash 2 control register the flash 2 control register (fl2cr) controls flash program, erase, and margin operations. note: devices with more than one flash have multiple control registers (flcrs). only one flash control register should be accessed at a time, so while accessing one control register, ensure that any others are cleared. f1div0, f2div0 frequency divide control bit these bits are logically ored together and the output selects the factor by which cgmvclk is divided to derive the charge pump frequency. se e table 10-3 . note that f1div1 and f2div1 have no effect. address: $fe0c bit 7 65432 1 bit 0 read: f1div1 f1div0 f1blk1 f1blk0 hven marg erase pgm w r ite: reset: 00000000 figure 10-1. flash 1 control register (fl1cr) address: $fe0a bit 7 65432 1 bit 0 read: f2div1 f2div0 f2blk1 f2blk0 hven marg erase pgm w r ite: reset: 00000000 figure 10-2. flash 2 control register (fl2cr)
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 156 48-kbyte flash memory motorola f1blk1, f1blk0, f2blk1, f2blk0 block erase control bits these bits control erasing of blocks of varying size. table 10-1 and table 10-2 show the various block sizes which can be erased in one erase operation. table 10-1. 32-kbyte erase block sizes f1blk1 f1blk0 block size row boundaries 0 0 full array: 32 kbytes 0C511 ($8000C$ffff) 0 1 one-half array: 16 kbytes 0C255 ($8000C$bfff) 256C511 ($c000C$ffff) 1 0 eight rows: 512 bytes 0C7 ($8000C$81ff) 8C15 ($8200C$83ff) 16C23 ($8400C$86ff) --- 504C511 ($fe00C$ffff) 1 1 single row: 64 bytes 0 ($8000C$803f) 1 ($8040C$807f) ---- 511 ($ffc0C$ffff) table 10-2. 16-kbyte erase block sizes f2blk1 f2blk0 block size row boundaries 0 0 full array: 16 kbytes 0C255 ($4000C$7fff) 0 1 one half array: 8 kbytes 0C127 ($4000C$5fff) 128C255 ($6000C$7fff) 1 0 eight rows: 512 bytes 0C7 ($4000C$41ff) 8C15 ($4200C$43ff) 16C23 ($4400C$45ff) --- 248C255 ($7e00C$7fff) 1 1 single row: 64 bytes 0 ($4000C$403f) 1 ($4040C$407f) ---- 255 ($7fc0C$7fff)
48-kbyte flash memory flash 2 control register mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 157 non-disclosure agreement required in step 4 of the erase operation in 10.10 flash erase operation , the upper addresses are latched and used to determine the location of the block to be erased. for the full array, the only requirement is that the target address points to any byte in this array. writing to any address in the array will enable the erase. hven high-voltage enable bit this read/write bit enables high voltage from the charge pump to the memory for either program or erase operation. it can only be set if either pgm or erase is set. 1 = high voltage enabled to array and charge pump on 0 = high voltage disabled to array and charge pump off marg program margin control bit this read/write bit configures the memory for a program margin operation. it cannot be set if the hven bit is set, and if it is set when hven is set, it will return to 0 automatically. 1 = margin operation selected 0 = margin operation unselected erase erase control bit this read/write bit configures the memory for erase operation. it is interlocked with the pgm bit such that both bits cannot be set to 1 at the same time. 1 = erase operation selected 0 = erase operation unselected pgm program control bit this read/write bit configures the memory for program operation. it is interlocked with the erase bit such that both bits cannot be equal to 1 or set to 1 at the same time. 1 = program operation selected 0 = program operation unselected
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 158 48-kbyte flash memory motorola 10.6 flash 1 block protect register the flash 1 block protect register (fl1bpr) is implemented as an input/output (i/o) register. each bit, when programmed, protects a range of addresses in the flash. f1bpr3 block protect register bit 3 this bit protects the memory contents in the address range $c000 to $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program f1bpr2 block protect register bit 2 this bit protects the memory contents in the address range $a000 to $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program f1bpr1 block protect register bit 1 this bit protects the memory contents in the address range $9000 to $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program f1bpr0 block protect register bit 0 this bit protects the memory contents in the address range $8000 to $ffff. 1 = address range protected from erase or program 0 = address range open to erase or program address: $001f bit 7 654321 bit 0 read: write: f1bpr3 f1bpr2 f1bpr1 f1bpr0 reset: x x x x 1111 = unimplemented x = indeterminate figure 10-3. flash 1 block protect register (fl1bpr)
48-kbyte flash memory flash 2 block protect register mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 159 non-disclosure agreement required by programming the block protect bits, a portion of the memory will be locked so that no further erase or program operations may be performed. programming more than one bit at a time is redundant. if both f1bpr3 and f1bpr2 are set, for instance, the address range $a000 through $ffff is locked. if all bits are cleared, then all of the memory is available for erase and program. 10.7 flash 2 block protect register the flash 2 block protect register (fl2bpr) is implemented as an i/o register. each bit, when programmed, protects a range of addresses in the flash. f2bpr3 block protect register bit 3 this bit protects the memory contents in the address range $6000 to $7fff. 1 = address range protected from erase or program 0 = address range open to erase or program f2bpr2 block protect register bit 2 this bit protects the memory contents in the address range $5000 to $7fff. 1 = address range protected from erase or program 0 = address range open to erase or program address: $004f bit 7 654321 bit 0 read: write: f2bpr3 f2bpr2 f2bpr1 f2bpr0 reset: x x x x 1111 = unimplemented x = indeterminate figure 10-4. flash 2 block protect register (fl2bpr)
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 160 48-kbyte flash memory motorola f2bpr1 block protect register bit 1 this bit protects the memory contents in the address range $4800 to $7fff. 1 = address range protected from erase or program 0 = address range open to erase or program f2bpr0 block protect register bit 0 this bit protects the memory contents in the address range $4000 to $7fff. 1 = address range protected from erase or program 0 = address range open to erase or program by programming the block protect bits, a portion of the memory will be locked so that no further erase or program operations may be performed. programming more than one bit at a time is redundant. if both f2bpr3 and f2bpr2 are set, for instance, the address range $5000 through $7fff is locked. if all bits are cleared, then all of the memory is available for erase and program. 10.8 block protection because of the ability of the on-board charge pump to erase and program the flash memory in the target application, provision is made for protecting blocks of memory from unintentional erase or program operations. this protection is done by reserving a location in the i/o space for block protect information. if the address range for an erase or program operation includes a protected block, the pgm or erase bit is cleared which prevents the hven bit in the flash control register from being set so that no high voltage is allowed in the array. when the block protect register is cleared, the entire memory is accessible for program and erase. when bits within the register are programmed, they lock blocks of memory address ranges as shown in 10.7 flash 2 block protect register .
48-kbyte flash memory charge pump frequency control mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 161 non-disclosure agreement required 10.9 charge pump frequency control the internal charge pump for this array is to be operated over the specified frequency range (refer to 22.16 2-k flash memory electrical characteristics ). the pll output clock, cgmvclk, is used to derive the two quadrature clocks, vclk12 and vclk23 which are one-half cgmvclk. additional pump frequency control is provided using the fxdiv0 bit in order to keep the vclks within the specified range. the pll must be on and locked (but not necessarily engaged) before program/erase operations can be performed. 10.10 flash erase operation note: after a total of eight program operations have been applied to a row, the row must be erased before further use to avoid the disturb condition. an erased byte will read $00. section 22. electrical specifications has a detailed description of the times used in this algorithm. use this step-by-step procedure to erase a block of flash memory: 1. establish pump frequency by configuring pll. 2. unprotect target portion of the array (fxbpr0Cfxbpr3). 3. set the erase bit, the fxblk0, fxblk1, and fxdiv0 bits in the flash control register. 4. write to any flash address with any data within the block address range desired. 5. set the hven bit. 6. wait for a time, t erase . table 10-3. charge pump clock frequency fdiv0 pump clock frequency 0 cgmvclk ? 2 1 cgmvclk ? 4
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 162 48-kbyte flash memory motorola 7. clear the hven bit. 8. wait for a time, t kill , for the high voltages to dissipate. 9. clear the erase bit. 10. after a time, t hvd , the memory can be accessed in read mode again. note: these operations must be performed in the order shown, but other unrelated operations may occur between the steps. do not exceed t erase maximum. 10.11 flash program and margin read operation programming of this flash array is done on a page basis where one page equals eight bytes. the purpose of the margin read mode is to ensure that data has been programmed with sufficient margin for long- term data retention. during a margin read, the control gates of the selected memory bits are held at a slightly negative voltage by an internal charge pump. reading the data in margin mode is the same as for ordinary read mode except that a built-in counter stretches the data access for an additional eight cycles to allow sensing of the lower cell current. in short, a margin read applies a more stringent condition on the bitcell during read which ensures the data will be valid throughout the life of the product. a margin read can only follow a program operation. all times listed here are specified in section 22. electrical specifications . the step-by-step procedure for programming the flash memory is: 1. establish pump frequency by configuring the pll. 2. set the pgm bit and program fxdiv0 appropriately. this configures the memory for program operation and enables the latching of address and data for programming. 3. write data to the page (8 bytes) being programmed. 4. set the hven bit. 5. wait for a time, t s tep. 6. clear the hven bit.
48-kbyte flash memory flash program and margin read operation mc68hc(9)08pt48 rev. 2.0 advance information motorola 48-kbyte flash memory 163 non-disclosure agreement required 7. wait for a time, t hvtv. 8. set the marg bit. 9. wait for a time, t vtp. 10. clear the pgm bit. 11. wait for a time, t hvd . 12. read the page of data. (this is in margin mode.) 13. clear the marg bit. 14. if any programmed bits do not read correctly, repeat the process from step 2 through 13 up to maximum program pulses. (see 22.16 2-k flash memory electrical characteristics .)
non-disclosure agreement required 48-kbyte flash memory advance information mc68hc(9)08pt48 rev. 2.0 164 48-kbyte flash memory motorola figure 10-5. page program algorithm program flash initialize attempt counter set pgm bit and fxdiv bits wait t hvtv wait t vtp set hven bit clear pgm bit set margin bit wait t hvd increment attempt counter yes no to 0 yes no programming operation failed programming operation complete write data to selected page wait t step clear hven bit read page of data clear margin bit read data equal to write data? attempt count equal to 5? note: this page program algorithm assumes the pll is on and locked, and the page in question has been erased before entry.
mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 165 non-disclosure agreement required advance information mc68hc(9)08pt48 section 11. serial peripheral interface (spi) module 11.1 contents 11.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 11.4.1 master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 11.5 slave mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 11.6 transmission formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171 11.6.1 clock phase and polarity controls . . . . . . . . . . . . . . . . . .171 11.6.2 transmission format when cpha = 0 . . . . . . . . . . . . . . .171 11.6.3 transmission format when cpha = 1 . . . . . . . . . . . . . . .173 11.6.4 transmission initiation latency . . . . . . . . . . . . . . . . . . . . .174 11.7 queuing transmission data . . . . . . . . . . . . . . . . . . . . . . . . . .176 11.8 error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 11.8.1 overflow error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177 11.8.2 mode fault error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 11.9 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 11.10 resetting the spi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 11.11 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 11.12 spi during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .185 11.13 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 11.13.1 miso (master in/slave out) . . . . . . . . . . . . . . . . . . . . . . .186 11.13.2 mosi (master out/slave in) . . . . . . . . . . . . . . . . . . . . . . .186 11.13.3 spsck (serial clock) . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 11.13.4 ss (slave select) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 11.13.5 cgnd (clock ground) . . . . . . . . . . . . . . . . . . . . . . . . . . .188 11.14 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 11.14.1 spi control register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 11.14.2 spi status and control register . . . . . . . . . . . . . . . . . . .192 11.14.3 spi data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 166 serial peripheral interface (spi) module motorola 11.2 introduction this section describes the serial peripheral interface (spi) module which allows full-duplex, synchronous, serial communications with peripheral devices. 11.3 features features of the spi module include: ? full-duplex operation ? master and slave modes ? double-buffered operation with separate transmit and receive registers ? four master mode frequencies (maximum = bus frequency ? 2) ? maximum slave mode frequency = bus frequency ? clock ground for reduced radio frequency (rf) interference ? serial clock with programmable polarity and phase ? two separately enabled interrupts: C sprf (spi receiver full) C spte (spi transmitter empty) ? mode fault error flag with cpu interrupt capability ? overflow error flag with cpu interrupt capability ? programmable wired-or mode ?i 2 c (inter-integrated circuit) compatibility 11.4 functional description figure 11-1 shows the structure of the spi module and figure 11-2 shows the locations and contents of the spi input/output (i/o) registers.
serial peripheral interface (spi) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 167 non-disclosure agreement required figure 11-1. spi module block diagram the spi module allows full-duplex, synchronous, serial communication between the mcu and peripheral devices, including other mcus. software can poll the spi status flags or spi operation can be interrupt- driven. the following subsections describe the operation of the spi module. transmitter cpu interrupt request receiver/error cpu interrupt request 76543210 spr1 spmstr transmit data register shift register spr0 cgmout 2 clock select 2 clock divider 8 32 128 clock logic cpha cpol spi sprie dmas spe spwom sprf spte ovrf m s pin control logic receive data register sptie spe internal bus (from sim) modfen errie control modf spmstr mosi miso spsck ss
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 168 serial peripheral interface (spi) module motorola 11.4.1 master mode the spi operates in master mode when the spi master bit, spmstr, is set. note: configure the spi modules as master or slave before enabling them. enable the master spi before enabling the slave spi. disable the slave spi before disabling the master spi. (see 11.14.1 spi control register .) only a master spi module can initiate transmissions. software begins the transmission from a master spi module by writing to the transmit data register. if the shift register is empty, the byte immediately transfers to the shift register, setting the spi transmitter empty bit, spte. the byte begins shifting out on the mosi pin under the control of the serial clock. (see figure 11-3 .) the spr1 and spr0 bits control the baud rate generator and determine the speed of the shift register. (see 11.14.2 spi status and control register .) through the spsck pin, the baud rate generator of the master also controls the shift register of the slave peripheral. addr. register name bit 7 6 5 4 3 2 1 bit 0 $000f spi control register (spcr) read: sprie dmas spmstr cpol cpha spwom spe sptie write: reset: 0 0 1 0 1 0 0 0 $0010 spi status and control register (spscr) read: sprf errie ovrf modf spte modfen spr1 spr0 write: reset: 0 0 0 0 1 0 0 0 $0011 spi data register (spdr) read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: indeterminate after reset = unimplemented figure 11-2. spi i/o register summary
serial peripheral interface (spi) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 169 non-disclosure agreement required as the byte shifts out on the mosi pin of the master, another byte shifts in from the slave on the masters miso pin. the transmission ends when the receiver full bit, sprf, becomes set. at the same time that sprf becomes set, the byte from the slave transfers to the receive data register. in normal operation, sprf signals the end of a transmission. software clears sprf by reading the spi status and control register with sprf set and then reading the spi data register. writing to the spi data register clears the spte bit. when the dmas bit is set, the spi status and control register does not have to be read to clear the sprf bit. a read of the spi data register by either the cpu or the dma clears the sprf bit. a write to the spi data register clears the spte bit. note: this device has no dma. dmas should be cleared. figure 11-3. full-duplex master-slave connections shift register shift register baud rate generator master mcu slave mcu v dd mosi mosi miso miso spsck spsck ss ss
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 170 serial peripheral interface (spi) module motorola 11.5 slave mode the spi operates in slave mode when the spmstr bit is clear. in slave mode, the spsck pin is the input for the serial clock from the master mcu. before a data transmission occurs, the ss pin of the slave spi must be at logic 0. ss must remain low until the transmission is complete. (see 11.8.2 mode fault error .) in a slave spi module, data enters the shift register under the control of the serial clock from the master spi module. after a byte enters the shift register of a slave spi, it transfers to the receive data register, and the sprf bit is set. to prevent an overflow condition, slave software then must read the receive data register before another full byte enters the shift register. the maximum frequency of the spsck for an spi configured as a slave is the bus clock speed (which is twice as fast as the fastest master spsck clock that can be generated). the frequency of the spsck for an spi configured as a slave does not have to correspond to any spi baud rate. the baud rate only controls the speed of the spsck generated by an spi configured as a master. therefore, the frequency of the spsck for an spi configured as a slave can be any frequency less than or equal to the bus speed. when the master spi starts a transmission, the data in the slave shift register begins shifting out on the miso pin. the slave can load its shift register with a new byte for the next transmission by writing to its transmit data register. the slave must write to its transmit data register at least one bus cycle before the master starts the next transmission. otherwise the byte already in the slave shift register shifts out on the miso pin. data written to the slave shift register during a transmission remains in a buffer until the end of the transmission. when the clock phase bit (cpha) is set, the first edge of spsck starts a transmission. when cpha is clear, the falling edge of ss starts a transmission. (see 11.6 transmission formats .) note: spsck must be in the proper idle state before the slave is enabled to prevent spsck from appearing as a clock edge.
serial peripheral interface (spi) module transmission formats mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 171 non-disclosure agreement required 11.6 transmission formats during an spi transmission, data is simultaneously transmitted (shifted out serially) and received (shifted in serially). a serial clock synchronizes shifting and sampling on the two serial data lines. a slave select line allows selection of an individual slave spi device; slave devices that are not selected do not interfere with spi bus activities. on a master spi device, the slave select line can optionally be used to indicate multiple- master bus contention. 11.6.1 clock phase and polarity controls software can select any of four combinations of serial clock (spsck) phase and polarity using two bits in the spi control register (spcr). the clock polarity is specified by the cpol control bit, which selects an active high or low clock and has no significant effect on the transmission format. the clock phase (cpha) control bit selects one of two fundamentally different transmission formats. the clock phase and polarity should be identical for the master spi device and the communicating slave device. in some cases, the phase and polarity are changed between transmissions to allow a master device to communicate with peripheral slaves having different requirements. note: before writing to the cpol bit or the cpha bit, disable the spi by clearing the spi enable bit (spe). 11.6.2 transmission format when cpha = 0 figure 11-4 shows an spi transmission in which cpha is logic 0. the figure should not be used as a replacement for data sheet parametric information.two waveforms are shown for spsck: one for cpol = 0 and another for cpol = 1. the diagram may be interpreted as a master or slave timing diagram since the serial clock (spsck), master in/slave out (miso), and master out/slave in (mosi) pins are directly connected between the master and the slave. the miso signal is the output from the slave, and the mosi signal is the output from the master. the ss line
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 172 serial peripheral interface (spi) module motorola is the slave select input to the slave. the slave spi drives its miso output only when its slave select input ( ss) is at logic 0, so that only the selected slave drives to the master. the ss pin of the master is not shown but is assumed to be inactive. the ss pin of the master must be high or must be reconfigured as general-purpose i/o not affecting the spi. (see 11.8.2 mode fault error .) when cpha = 0, the first spsck edge is the msb (most significant bit) capture strobe. therefore the slave must begin driving its data before the first spsck edge, and a falling edge on the ss pin is used to start the slave data transmission. the slaves ss pin must be toggled back to high and then low again between each byte transmitted as shown in figure 11-5 . figure 11-4. transmission format (cpha = 0) figure 11-5. cpha/ ss timing bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb 1234 5678 spsck cycle # for reference spsck; cpol = 0 spsck; cpol =1 mosi from master miso from slave ss; to slave capture strobe byte 1 byte 3 miso/mosi byte 2 master ss slave ss cpha = 0 slave ss cpha = 1
serial peripheral interface (spi) module transmission formats mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 173 non-disclosure agreement required when cpha = 0 for a slave, the falling edge of ss indicates the beginning of the transmission. this causes the spi to leave its idle state and begin driving the miso pin with the msb of its data. once the transmission begins, no new data is allowed into the shift register from the transmit data register. therefore, the spi data register of the slave must be loaded with transmit data before the falling edge of ss. any data written after the falling edge is stored in the transmit data register and transferred to the shift register after the current transmission. 11.6.3 transmission format when cpha = 1 figure 11-6 shows an spi transmission in which cpha is logic 1. the figure should not be used as a replacement for data sheet parametric information. two waveforms are shown for spsck: one for cpol = 0 and another for cpol = 1. the diagram may be interpreted as a master or slave timing diagram since the serial clock (spsck), master in/slave out (miso), and master out/slave in (mosi) pins are directly connected between the master and the slave. the miso signal is the output from the slave, and the mosi signal is the output from the master. the ss line is the slave select input to the slave. the slave spi drives its miso output only when its slave select input ( ss) is at logic 0, so that only the selected slave drives to the master. the ss pin of the master is not shown but is assumed to be inactive. the ss pin of the master must be high or must be reconfigured as general-purpose i/o not affecting the spi. (see 11.8.2 mode fault error .) when cpha = 1, the master begins driving its mosi pin on the first spsck edge. therefore, the slave uses the first spsck edge as a start transmission signal. the ss pin can remain low between transmissions. this format may be preferable in systems having only one master and only one slave driving the miso data line. when cpha = 1 for a slave, the first edge of the spsck indicates the beginning of the transmission. this causes the spi to leave its idle state and begin driving the miso pin with the msb of its data. once the transmission begins, no new data is allowed into the shift register from the transmit data register. therefore, the spi data register of the slave must be loaded with transmit data before the first edge of spsck. any data written after the first edge is stored in the transmit data register and transferred to the shift register after the current transmission.
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 174 serial peripheral interface (spi) module motorola figure 11-6. transmission format (cpha = 1) 11.6.4 transmission initiation latency when the spi is configured as a master (spmstr = 1), writing to the spdr starts a transmission. cpha has no effect on the delay to the start of the transmission, but it does affect the initial state of the spsck signal. when cpha = 0, the spsck signal remains inactive for the first half of the first spsck cycle. when cpha = 1, the first spsck cycle begins with an edge on the spsck line from its inactive to its active level. the spi clock rate (selected by spr1:spr0) affects the delay from the write to spdr and the start of the spi transmission. (see figure 11-7 .) the internal spi clock in the master is a free-running derivative of the internal mcu clock. to conserve power, it is enabled only when both the spe and spmstr bits are set. spsck edges occur halfway through the low time of the internal mcu clock. since the spi clock is free-running, it is uncertain where the write to the spdr occurs relative to the slower spsck. this uncertainty causes the variation in the initiation delay shown in figure 11-7 . this delay is no longer than a single spi bit time. that is, the maximum delay is two mcu bus cycles for div2, eight mcu bus cycles for div8, 32 mcu bus cycles for div32, and 128 mcu bus cycles for div128. bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb 1234 5678 spsck cycle # for reference spsck; cpol = 0 spsck; cpol =1 mosi from master miso from slave ss ; to slave capture strobe
serial peripheral interface (spi) module transmission formats mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 175 non-disclosure agreement required figure 11-7. transmission start delay (master) write to spdr initiation delay bus mosi spsck cpha = 1 spsck cpha = 0 spsck cycle number msb bit 6 12 clock write to spdr earliest latest spsck = internal clock ? 2; earliest latest 2 possible start points spsck = internal clock ? 8; 8 possible start points earliest latest spsck = internal clock ? 32; 32 possible start points earliest latest spsck = internal clock ? 128; 128 possible start points write to spdr write to spdr write to spdr bus clock bit 5 3 bus clock bus clock bus clock ? ? ? ? ? ? initiation delay from write spdr to transfer begin
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 176 serial peripheral interface (spi) module motorola 11.7 queuing transmission data the double-buffered transmit data register allows a data byte to be queued and transmitted. for an spi configured as a master, a queued data byte is transmitted immediately after the previous transmission has completed. the spi transmitter empty flag (spte) indicates when the transmit data buffer is ready to accept new data. write to the transmit data register only when the spte bit is high. figure 11-8 shows the timing associated with doing back-to-back transmissions with the spi. (spsck has cpha:cpol = 1:0.) figure 11-8. sprf/spte cpu interrupt timing bit 3 mosi spsck; cpha:cpol = 1:0 spte write to spdr 1 cpu writes byte 2 to spdr, queueing cpu writes byte 1 to spdr, clearing byte 1 transfers from transmit data 3 1 2 2 3 5 spte bit. register to shift register, setting spte bit. sprf read spscr msb bit 6 bit 5 bit 4 bit 2 bit 1 lsb msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 lsb msb bit 6 byte 2 transfers from transmit data cpu writes byte 3 to spdr, queueing byte 3 transfers from transmit data 5 8 10 8 10 4 first incoming byte transfers from shift 6 cpu reads spscr with sprf bit set. 4 6 9 second incoming byte transfers from shift 9 11 byte 2 and clearing spte bit. register to shift register, setting spte bit. register to receive data register, setting sprf bit. byte 3 and clearing spte bit. register to shift register, setting spte bit. register to receive data register, setting sprf bit. 12 cpu reads spdr, clearing sprf bit. bit 5 bit 4 byte 1 byte 2 byte 3 7 12 read spdr 7 cpu reads spdr, clearing sprf bit. 11 cpu reads spscr with sprf bit set.
serial peripheral interface (spi) module error conditions mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 177 non-disclosure agreement required the transmit data buffer allows back-to-back transmissions without the slave precisely timing its writes between transmissions as in a system with a single data buffer. also, if no new data is written to the data buffer, the last value contained in the shift register is the next data word to be transmitted. for an idle master or idle slave that has no data loaded into its transmit buffer, the spte is set again no more than two bus cycles after the transmit buffer empties into the shift register. this allows the user to queue up a 16-bit value to send. for an already active slave, the load of the shift register cannot occur until the transmission is completed. this implies that a back-to-back write to the transmit data register is not possible. the spte indicates when the next write can occur. 11.8 error conditions these flags signal spi error conditions: ? overflow (ovrf) failing to read the spi data register before the next full byte enters the shift register sets the ovrf bit. the new byte does not transfer to the receive data register, and the unread byte still can be read. ovrf is in the spi status and control register. ? mode fault error (modf) the modf bit indicates that the voltage on the slave select pin ( ss) is inconsistent with the mode of the spi. modf is in the spi status and control register. 11.8.1 overflow error the overflow flag (ovrf) becomes set if the receive data register still has unread data from a previous transmission when the capture strobe of bit 1 of the next transmission occurs. the bit 1 capture strobe occurs in the middle of spsck cycle 7. (see figure 11-4 and figure 11-6 .) if an overflow occurs, all data received after the overflow and before the ovrf bit is cleared does not transfer to the receive data register and does not set the spi receiver full bit (sprf). the unread data that transferred to the receive data register before the overflow occurred can
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 178 serial peripheral interface (spi) module motorola still be read. therefore, an overflow error always indicates the loss of data. clear the overflow flag by reading the spi status and control register and then reading the spi data register. note: this device has no dma. dmas should be cleared. ovrf generates a receiver/error cpu interrupt request if the error interrupt enable bit (errie) is also set. when the dmas bit is low, the sprf, modf, and ovrf interrupts share the same cpu interrupt vector. when the dmas bit is high, sprf generates a receiver dma service request, and modf and ovrf can generate a receiver/error cpu interrupt request. (see figure 11-11 .) it is not possible to enable modf or ovrf individually to generate a receiver/error cpu interrupt request. however, leaving modfen low prevents modf from being set. if the cpu sprf interrupt is enabled and the ovrf interrupt is not, watch for an overflow condition. figure 11-9 shows how it is possible to miss an overflow. the first part of figure 11-9 shows how it is possible to read the spscr and spdr to clear the sprf without problems. however, as illustrated by the second transmission example, the ovrf bit can be set in between the time that spscr and spdr are read. figure 11-9. missed read of overflow condition read spdr read spscr ovrf sprf byte 1 byte 2 byte 3 byte 4 byte 1 sets sprf bit. cpu reads spscr with sprf bit set cpu reads byte 1 in spdr, byte 2 sets sprf bit. cpu reads spscr with sprf bit set byte 3 sets ovrf bit. byte 3 is lost. cpu reads byte 2 in spdr, clearing sprf bit, byte 4 fails to set sprf bit because 1 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 clearing sprf bit. but not ovrf bit. ovrf bit is not cleared. byte 4 is lost. and ovrf bit clear. and ovrf bit clear.
serial peripheral interface (spi) module error conditions mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 179 non-disclosure agreement required in this case, an overflow can easily be missed. since no more sprf interrupts can be generated until this ovrf is serviced, it is not obvious that bytes are being lost as more transmissions are completed. to prevent this, either enable the ovrf interrupt or do another read of the spscr following the read of the spdr. this ensures that the ovrf was not set before the sprf was cleared and that future transmissions can set the sprf bit. figure 11-10 illustrates this process. generally, to avoid this second spscr read, enable the ovrf to the cpu by setting the errie bit. figure 11-10. clearing sprf when ovrf interrupt is not enabled read spdr read spscr ovrf sprf byte 1 byte 2 byte 3 byte 4 1 byte 1 sets sprf bit. cpu reads spscr with sprf bit set cpu reads byte 1 in spdr, cpu reads spscr again byte 2 sets sprf bit. cpu reads spscr with sprf bit set byte 3 sets ovrf bit. byte 3 is lost. cpu reads byte 2 in spdr, cpu reads spscr again cpu reads byte 2 spdr, byte 4 sets sprf bit. cpu reads spscr. cpu reads byte 4 in spdr, cpu reads spscr again 1 2 3 clearing sprf bit. 4 to check ovrf bit. 5 6 7 8 9 clearing sprf bit. to check ovrf bit. 10 clearing ovrf bit. 11 12 13 14 2 3 4 5 6 7 8 9 10 11 12 13 14 clearing sprf bit. to check ovrf bit. spi receive complete and ovrf bit clear. and ovrf bit clear.
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 180 serial peripheral interface (spi) module motorola 11.8.2 mode fault error setting the spmstr bit selects master mode and configures the spsck and mosi pins as outputs and the miso pin as an input. clearing spmstr selects slave mode and configures the spsck and mosi pins as inputs and the miso pin as an output. the mode fault bit, modf, becomes set any time the state of the slave select pin, ss, is inconsistent with the mode selected by spmstr. to prevent spi pin contention and damage to the mcu, a mode fault error occurs if: ? the ss pin of a slave spi goes high during a transmission. ? the ss pin of a master spi goes low at any time. for the modf flag to be set, the mode fault error enable bit (modfen) must be set. clearing the modfen bit does not clear the modf flag but does prevent modf from being set again after modf is cleared. note: this device has no dma. dmas should be cleared. modf generates a receiver/error cpu interrupt request if the error interrupt enable bit (errie) is also set. when the dmas bit is low, the sprf, modf, and ovrf interrupts share the same cpu interrupt vector. when the dmas bit is high, sprf generates a receiver dma service request instead of a cpu interrupt request, but modf and ovrf can generate a receiver/error cpu interrupt request. (see figure 11-11 .) it is not possible to enable modf or ovrf individually to generate a receiver/error cpu interrupt request. however, leaving modfen low prevents modf from being set. in a master spi with the mode fault enable bit (modfen) set, the mode fault flag (modf) is set if ss goes to logic 0. a mode fault in a master spi causes these events to occur: ? if errie = 1, the spi generates an spi receiver/error cpu interrupt request. ? the spe bit is cleared. ? the spte bit is set. ? the spi state counter is cleared. ? the data direction register of the shared i/o port regains control of port drivers.
serial peripheral interface (spi) module error conditions mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 181 non-disclosure agreement required note: to prevent bus contention with another master spi after a mode fault error, clear all spi bits of the data direction register of the shared i/o port before enabling the spi. when configured as a slave (spmstr = 0), the modf flag is set if ss goes high during a transmission. when cpha = 0, a transmission begins when ss goes low and ends once the incoming spsck goes back to its idle level following the shift of the eighth data bit. when cpha = 1, the transmission begins when the spsck leaves its idle level and ss is already low. the transmission continues until the spsck returns to its idle level following the shift of the last data bit. (see 11.6 transmission formats .) note: setting the modf flag does not clear the spmstr bit. the spmstr bit has no function when spe = 0. reading spmstr when modf = 1 shows the difference between a modf occurring when the spi is a master and when it is a slave. note: when cpha = 0, a modf occurs if a slave is selected ( ss is at logic 0) and later unselected ( ss is at logic 1) even if no spsck is sent to that slave. this happens because ss at logic 0 indicates the start of the transmission (miso driven out with the value of msb) for cpha = 0. when cpha = 1, a slave can be selected and then later unselected with no transmission occurring. therefore, modf does not occur since a transmission was never begun. in a slave spi (mstr = 0), the modf bit generates an spi receiver/error cpu interrupt request if the errie bit is set. the modf bit does not clear the spe bit or reset the spi in any way. software can abort the spi transmission by clearing the spe bit of the slave. note: a logic 1 voltage on the ss pin of a slave spi puts the miso pin in a high impedance state. also, the slave spi ignores all incoming spsck clocks, even if it was already in the middle of a transmission. to clear the modf flag, read the spscr with the modf bit set and then write to the spcr register. this entire clearing mechanism must occur with no modf condition existing or else the flag is not cleared.
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 182 serial peripheral interface (spi) module motorola 11.9 interrupts four spi status flags can be enabled to generate cpu interrupt requests, see table 11-1 . note: this device has no dma. dmas should be cleared. the dma select bit (dmas) controls whether spte and sprf generate cpu interrupt requests or dma service requests. when dmas = 0, reading the spi status and control register with sprf set and then reading the receive data register clears sprf. when dmas = 1, any read of the receive data register clears the sprf flag. the clearing mechanism for the spte flag is always just a write to the transmit data register. the spi transmitter interrupt enable bit (sptie) enables the spte flag to generate transmitter interrupt requests provided that the spi is enabled (spe = 1). the spi receiver interrupt enable bit (sprie) enables the sprf bit to generate receiver interrupt requests regardless of the state of the spe bit. (see figure 11-11 .) the error interrupt enable bit (errie) enables both the modf and ovrf bits to generate a receiver/error cpu interrupt request. table 11-1. spi interrupts flag request spte transmitter empty spi transmitter cpu interrupt request dmas = 0, sptie = 1, spe = 1 spi transmitter dma service request dmas = 1, sptie = 1, spe = 1 sprf receiver full spi receiver cpu interrupt request dmas = 0, sprie = 1 spi receiver dma service request dmas = 1, sprie = 1 ovrf over?ow spi receiver/error interrupt request errie = 1 modf mode fault spi receiver/error interrupt request errie = 1
serial peripheral interface (spi) module interrupts mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 183 non-disclosure agreement required the mode fault enable bit (modfen) can prevent the modf flag from being set so that only the ovrf bit is enabled by the errie bit to generate receiver/error cpu interrupt requests. figure 11-11. spi interrupt request generation note: this device has no dma. dmas should be cleared. the following two sources in the spi status and control register can generate interrupt requests. ? spi receiver full bit (sprf) the sprf bit becomes set every time a byte transfers from the shift register to the receive data register. if the spi receiver interrupt enable bit, sprie, is also set, sprf can generate either an spi receiver/error cpu interrupt request or an sprf dma service request. if the dma select bit, dmas, is clear, sprf generates an sprf cpu interrupt request. if dmas is set, sprf generates an sprf dma service request. spi transmitter spte sptie sprf sprie dmas errie modf ovrf spe dma service request spi transmitter cpu interrupt request spi receiver dma service request spi receiver/error cpu interrupt request
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 184 serial peripheral interface (spi) module motorola ? spi transmitter empty (spte) the spte bit becomes set every time a byte transfers from the transmit data register to the shift register. if the spi transmit interrupt enable bit, sptie, is also set, spte can generate either an spte cpu interrupt request or an spte dma service request. if the dmas bit is clear, spte generates an spte cpu interrupt request. if dmas is set, spte generates an spte dma service request. 11.10 resetting the spi any system reset completely resets the spi. partial resets occur whenever the spi enable bit (spe) is low. whenever spe is low, the following occurs: ? the spte flag is set. ? any transmission currently in progress is aborted. ? the shift register is cleared. ? the spi state counter is cleared, making it ready for a new complete transmission. ? all the spi port logic is disabled. these items are reset only by a system reset: ? all control bits in the spcr register ? all control bits in the spscr register (modfen, errie, spr1, and spr0) ? the status flags sprf, ovrf, and modf by not resetting the control bits when spe is low, the user can clear spe between transmissions without having to set all control bits again when spe is set back high for the next transmission. by not resetting the sprf, ovrf, and modf flags, the user can still service these interrupts after the spi has been disabled. the user can disable the spi by writing 0 to the spe bit. the spi can also be disabled by a mode fault occurring in an spi that was configured as a master with the modfen bit set.
serial peripheral interface (spi) module wait mode mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 185 non-disclosure agreement required 11.11 wait mode the spi module remains active after the execution of a wait instruction. in wait mode, the spi module registers are not accessible by the cpu. any enabled cpu interrupt request from the spi module can bring the mcu out of wait mode. if spi module functions are not required during wait mode, reduce power consumption by disabling the spi module before executing the wait instruction. 11.12 spi during break interrupts the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. (see 7.8.3 sim break flag control register .) to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. since the spte bit cannot be cleared during a break with the bcfe bit cleared, a write to the transmit data register in break mode does not initiate a transmission nor is this data transferred into the shift register. therefore, a write to the spdr in break mode with the bcfe bit cleared has no effect.
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 186 serial peripheral interface (spi) module motorola 11.13 i/o signals the spi module has five i/o (input/output) pins: ? miso data received ? mosi data transmitted ? spsck serial clock ? ss slave select ? cgnd clock ground the spi has limited inter-integrated circuit (i 2 c) capability (requiring software support) as a master in a single-master environment. to communicate with i 2 c peripherals, mosi becomes an open-drain output when the spwom bit in the spi control register is set. in i 2 c communication, the mosi and miso pins are connected to a bidirectional pin from the i 2 c peripheral and through a pullup resistor to v dd . 11.13.1 miso (master in/slave out) miso is one of the two spi module pins that transmit serial data. in full- duplex operation, the miso pin of the master spi module is connected to the miso pin of the slave spi module. the master spi simultaneously receives data on its miso pin and transmits data from its mosi pin. slave output data on the miso pin is enabled only when the spi is configured as a slave. the spi is configured as a slave when its spmstr bit is logic 0 and its ss pin is at logic 0. to support a multiple- slave system, a logic 1 on the ss pin puts the miso pin in a high- impedance state. 11.13.2 mosi (master out/slave in) mosi is one of the two spi module pins that transmit serial data. in full- duplex operation, the mosi pin of the master spi module is connected to the mosi pin of the slave spi module. the master spi simultaneously transmits data from its mosi pin and receives data on its miso pin.
serial peripheral interface (spi) module i/o signals mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 187 non-disclosure agreement required 11.13.3 spsck (serial clock) the serial clock synchronizes data transmission between master and slave devices. in a master mcu, the spsck pin is the clock output. in a slave mcu, the spsck pin is the clock input. in full duplex operation, the master and slave mcus exchange a byte of data in eight serial clock cycles. when enabled, the spi controls data direction of the spsck pin regardless of the state of the data direction register of the shared i/o port. 11.13.4 ss (slave select) the ss pin has various functions depending on the current state of the spi. for an spi configured as a slave, the ss is used to select a slave. for cpha = 0, the ss is used to define the start of a transmission. (see 11.6 transmission formats .) since it is used to indicate the start of a transmission, the ss must be toggled high and low between each byte transmitted for the cpha = 0 format. however, it can remain low between transmissions for the cpha = 1 format. see figure 11-12 . figure 11-12. cpha/ ss timing when an spi is configured as a slave, the ss pin is always configured as an input. it cannot be used as a general-purpose i/o regardless of the state of the modfen control bit. however, the modfen bit can still prevent the state of the ss from creating a modf error. (see 11.14.2 spi status and control register .) byte 1 byte 3 miso/mosi byte 2 master ss slave ss cpha = 0 slave ss cpha = 1
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 188 serial peripheral interface (spi) module motorola note: a logic 1 voltage on the ss pin of a slave spi puts the miso pin in a high- impedance state. the slave spi ignores all incoming spsck clocks, even if it was already in the middle of a transmission. when an spi is configured as a master, the ss input can be used in conjunction with the modf flag to prevent multiple masters from driving mosi and spsck. (see 11.8.2 mode fault error .) for the state of the ss pin to set the modf flag, the modfen bit in the spsck register must be set. if the modfen bit is low for an spi master, the ss pin can be used as a general-purpose i/o under the control of the data direction register of the shared i/o port. with modfen high, it is an input-only pin to the spi regardless of the state of the data direction register of the shared i/o port. the cpu can always read the state of the ss pin by configuring the appropriate pin as an input and reading the port data register. (see table 11-2 .) 11.13.5 cgnd (clock ground) cgnd is the ground return for the serial clock pin, spsck, and the ground for the port output buffers. it is connected to the ev ss1 pad. table 11-2. spi con?guration spe spmstr modfen spi configuration state of ss logic 0x (1) 1. x = dont care x not enabled general-purpose i/o; ss ignored by spi 1 0 x slave input-only to spi 1 1 0 master without modf general-purpose i/o; ss ignored by spi 1 1 1 master with modf input-only to spi
serial peripheral interface (spi) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 189 non-disclosure agreement required 11.14 i/o registers three i/o registers control and monitor spi operation: ? spi control register (spcr) ? spi status and control register (spscr) ? spi data register (spdr) 11.14.1 spi control register the spi control register (spcr): ? enables spi module interrupt requests ? selects cpu interrupt requests ? configures the spi module as master or slave ? selects serial clock polarity and phase ? configures the spsck, mosi, and miso pins as open-drain outputs ? enables the spi module
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 190 serial peripheral interface (spi) module motorola sprie spi receiver interrupt enable bit this read/write bit enables interrupt requests generated by the sprf bit. the sprf bit is set when a byte transfers from the shift register to the receive data register. 1 = sprf cpu interrupt requests or sprf dma service requests enabled 0 = sprf cpu interrupt requests or sprf dma service requests disabled dmas dma select bit this read/write bit selects dma service requests when the spi receiver full bit, sprf, or the spi transmitter empty bit, spte, becomes set. setting the dmas bit disables sprf cpu interrupt requests and spte cpu interrupt requests. 1 = sprf dma and spte dma service requests enabled (sprf cpu and spte cpu interrupt requests disabled) 0 = sprf dma and spte dma service requests disabled (sprf cpu and spte cpu interrupt requests enabled) note: this device has no dma. dmas should be cleared. spmstr spi master bit this read/write bit selects master mode operation or slave mode operation. 1 = master mode 0 = slave mode address: $000f bit 7 654321 bit 0 read: sprie dmas spmstr cpol cpha spwom spe sptie write: reset: 00101000 figure 11-13. spi control register (spcr)
serial peripheral interface (spi) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 191 non-disclosure agreement required cpol clock polarity bit this read/write bit determines the logic state of the spsck pin between transmissions. (see figure 11-4 and figure 11-6 .) to transmit data between spi modules, the spi modules must have identical cpol values. cpha clock phase bit this read/write bit controls the timing relationship between the serial clock and spi data. (see figure 11-4 and figure 11-6 .) to transmit data between spi modules, the spi modules must have identical cpha values. when cpha = 0, the ss pin of the slave spi module must be set to logic 1 between bytes. (see figure 11-12 .) spwom spi wired-or mode bit this read/write bit disables the pullup devices on pins spsck, mosi, and miso so that those pins become open-drain outputs. 1 = wired-or spsck, mosi, and miso pins 0 = normal push-pull spsck, mosi, and miso pins spe spi enable this read/write bit enables the spi module. clearing spe causes a partial reset of the spi. (see 11.10 resetting the spi .) 1 = spi module enabled 0 = spi module disabled sptie spi transmit interrupt enable this read/write bit enables interrupt requests generated by the spte bit. spte is set when a byte transfers from the transmit data register to the shift register. 1 = spte interrupt requests enabled 0 = spte interrupt requests disabled
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 192 serial peripheral interface (spi) module motorola 11.14.2 spi status and control register the spi status and control register (spscr) contains flags to signal these conditions: ? receive data register full ? failure to clear sprf bit before next byte is received (overflow error) ? inconsistent logic level on ss pin (mode fault error) ? transmit data register empty the spi status and control register also contains bits that perform these functions: ? enable error interrupts ? enable mode fault error detection ? select master spi baud rate sprf spi receiver full bit this clearable, read-only flag is set each time a byte transfers from the shift register to the receive data register. sprf generates an interrupt request if the sprie bit in the spi control register is set also. 1 = receive data register full 0 = receive data register not full address: $0010 bit 7 654321 bit 0 read: sprf errie ovrf modf spte modfen spr1 spr0 write: reset: 00001000 = unimplemented figure 11-14. spi status and control register (spscr)
serial peripheral interface (spi) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 193 non-disclosure agreement required errie error interrupt enable bit this read/write bit enables the modf and ovrf bits to generate cpu interrupt requests. reset clears the errie bit. 1 = modf and ovrf can generate cpu interrupt requests. 0 = modf and ovrf cannot generate cpu interrupt requests. ovrf overflow bit this clearable, read-only flag is set if software does not read the byte in the receive data register before the next full byte enters the shift register. in an overflow condition, the byte already in the receive data register is unaffected, and the byte that shifted in last is lost. clear the ovrf bit by reading the spi status and control register with ovrf set and then reading the receive data register. 1 = overflow 0 = no overflow modf mode fault bit this clearable, read-only flag is set in a slave spi if the ss pin goes high during a transmission with the modfen bit set. in a master spi, the modf flag is set if the ss pin goes low at any time with the modfen bit set. clear the modf bit by reading the spi status and control register (spscr) with modf set and then writing to the spi control register (spcr). 1 = ss pin at inappropriate logic level 0 = ss pin at appropriate logic level spte spi transmitter empty bit this clearable, read-only flag is set each time the transmit data register transfers a byte into the shift register. spte generates an interrupt request if the sptie bit in the spi control register is set also. 1 = transmit data register empty 0 = transmit data register not empty note: do not write to the spi data register unless the spte bit is high.
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 194 serial peripheral interface (spi) module motorola modfen mode fault enable bit this read/write bit, when set to 1, allows the modf flag to be set. if the modf flag is set, clearing the modfen does not clear the modf flag. if the spi is enabled as a master and the modfen bit is low, then the ss pin is available as a general-purpose i/o. if the modfen bit is set, then this pin is not available as a general purpose i/o. when the spi is enabled as a slave, the ss pin is not available as a general-purpose i/o regardless of the value of modfen. (see 11.13.4 ss (slave select) .) if the modfen bit is low, the level of the ss pin does not affect the operation of an enabled spi configured as a master. for an enabled spi configured as a slave, having modfen low only prevents the modf flag from being set. it does not affect any other part of spi operation. (see 11.8.2 mode fault error .) spr1 and spr0 spi baud rate select bits in master mode, these read/write bits select one of four baud rates as shown in table 11-3 . spr1 and spr0 have no effect in slave mode. reset clears spr1 and spr0. use this formula to calculate the spi baud rate: cgmout = base clock output of the clock generator module (cgm) bd = baud rate divisor table 11-3. spi master baud rate selection spr1:spr0 baud rate divisor (bd) 00 2 01 8 10 32 11 128 baud rate cgmout 2bd -------------------------- =
serial peripheral interface (spi) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial peripheral interface (spi) module 195 non-disclosure agreement required 11.14.3 spi data register the spi data register (spdr) consists of the read-only receive data register and the write-only transmit data register. writing to the spi data register writes data into the transmit data register. reading the spi data register reads data from the receive data register. the transmit data and receive data registers are separate registers that can contain different values. see figure 11-1. r7:r0/t7:t0 receive/transmit data bits note: do not use read-modify-write instructions on the spi data register since the register read is not the same as the register written. address: $0011 bit 7 654321 bit 0 read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: indeterminate after reset figure 11-15. spi data register (spdr)
non-disclosure agreement required serial peripheral interface (spi) module advance information mc68hc(9)08pt48 rev. 2.0 196 serial peripheral interface (spi) module motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 197 non-disclosure agreement required advance information mc68hc(9)08pt48 section 12. serial communications interface (sci) module 12.1 contents 12.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 12.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 12.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 12.4.1 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2 transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 12.4.2.2 character transmission . . . . . . . . . . . . . . . . . . . . . . . . .203 12.4.2.3 break characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204 12.4.2.4 idle characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 12.4.2.5 inversion of transmitted output. . . . . . . . . . . . . . . . . . .205 12.4.2.6 transmitter interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3 receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.1 character length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.2 character reception . . . . . . . . . . . . . . . . . . . . . . . . . . .206 12.4.3.3 data sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 12.4.3.4 framing errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 12.4.3.5 baud rate tolerance . . . . . . . . . . . . . . . . . . . . . . . . . . .210 12.4.3.6 receiver wakeup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .213 12.4.3.7 receiver interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.4.3.8 error interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214 12.5 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.5.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.5.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.6 sci during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .215 12.7 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 12.7.1 ptg2/txd (transmit data) . . . . . . . . . . . . . . . . . . . . . . . .216 12.7.2 ptg1/rxd (receive data) . . . . . . . . . . . . . . . . . . . . . . . .216
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 198 serial communications interface (sci) module motorola 12.8 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 12.8.1 sci control register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . .217 12.8.2 sci control register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . .220 12.8.3 sci control register 3 . . . . . . . . . . . . . . . . . . . . . . . . . . .222 12.8.4 sci status register 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 12.8.5 sci status register 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 12.8.6 sci data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 12.8.7 sci baud rate register . . . . . . . . . . . . . . . . . . . . . . . . . .229 12.2 introduction this section describes the serial communications interface module (sci, version d), which allows high-speed asynchronous communications with peripheral devices and other mcus. 12.3 features features of the sci module include: ? full-duplex operation ? standard mark/space non-return-to-zero (nrz) format ? 32 programmable baud rates ? selectable clock source for baud rate (see section 14. configuration register (config) ) ? programmable 8-bit or 9-bit character length ? separately enabled transmitter and receiver ? separate receiver and transmitter cpu interrupt requests ? separate receiver and transmitter dma service requests ? programmable transmitter output polarity ? two receiver wakeup methods: C idle line wakeup C address mark wakeup
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 199 non-disclosure agreement required ? interrupt-driven operation with eight interrupt flags: C transmitter empty C transmission complete C receiver full C idle receiver input C receiver overrun C noise error C framing error C parity error ? receiver framing error detection ? hardware parity checking ? 1/16 bit-time noise detection 12.4 functional description figure 12-1 shows the structure of the sci module. the sci allows full- duplex, asynchronous, nrz serial communication between the mcu and remote devices, including other mcus. the transmitter and receiver of the sci operate independently, although they use the same baud rate generator. during normal operation, the cpu monitors the status of the sci, writes the data to be transmitted, and processes received data.
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 200 serial communications interface (sci) module motorola figure 12-1. sci module block diagram scte tc scrf idle or nf fe pe sctie tcie scrie ilie te re rwu sbk r8 t8 dmate orie feie peie bkf rpf sci data receive shift register sci data register transmit shift register neie m wake ilty flag control transmit control receive control data selection control wakeup pty pen register dma interrupt control transmitter interrupt control receiver interrupt control error interrupt control control dmare ensci loops ensci ptg1/rxd ptg2/txd internal bus txinv loops ? 4 ? 16 pre- scaler baud rate generator clock source
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 201 non-disclosure agreement required addr. register name bit 7 6 5 4 3 2 1 bit 0 $0014 sci control register 1 (scc1) read: loops ensci txinv m wake ilty pen pty write: reset: 0 0 0 0 0 0 0 0 $0015 sci control register 2 (scc2) tcie sctie tcie scrie ilie te re rwu sbk write: reset: 0 0 0 0 0 0 0 0 $0016 sci control register 3 (scc3) read: r8 t8 dmare dmate orie neie feie peie write: reset: u u 0 0 0 0 0 0 $0017 sci status register 1 (scs1) read: scte tc scrf idle or nf fe pe write: reset: 1 1 0 0 0 0 0 0 $0018 sci status register 2 (scs2) read: bkf rpf write: reset: 0 0 0 0 0 0 0 0 $0019 sci data register (scdr) read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset $001a sci baud rate register (scbr) read: scp1 scp0 scr2 scr1 scr0 write: reset: 0 0 0 0 0 0 0 0 = unimplemented u = undetermined figure 12-2. sci i/o register summary
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 202 serial communications interface (sci) module motorola 12.4.1 data format the sci uses the standard non-return-to-zero (nrz) mark/space data format illustrated in figure 12-3 . figure 12-3. sci data formats 12.4.2 transmitter figure 12-4 shows the structure of the sci transmitter. note: the transmission output pin is enabled by te bit of scc2 instead of ensci bit of scc1. 12.4.2.1 character length the transmitter can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (scc1) determines character length. when transmitting 9-bit data, bit t8 in sci control register 3 (scc3) is the ninth bit (bit 8). bit 5 start bit bit 0 bit 1 next stop bit start bit 8-bit data format (bit m in scc1 clear) start bit bit 0 next stop bit start bit 9-bit data format (bit m in scc1 set) bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 2 bit 3 bit 4 bit 6 bit 7 possible parity bit possible parity bit
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 203 non-disclosure agreement required figure 12-4. sci transmitter 12.4.2.2 character transmission during an sci transmission, the transmit shift register shifts a character out to the ptg2/txd pin. the sci data register (scdr) is the write-only buffer between the internal data bus and the transmit shift register. to initiate an sci transmission: 1. enable the sci by writing a logic 1 to the enable sci bit (ensci) in sci control register 1 (scc1). 2. enable the transmitter by writing a logic 1 to the transmitter enable bit (te) in sci control register 2 (scc2). dmate scte pen pty h876543210l 11-bit transmit stop start t8 dmate scte sctie tcie rwu sbk tc clock source parity generation msb sci data register load from scdr shift enable preamble (all ones) break (all zeros) transmitter control logic shift register dmate tc sctie tcie scte cpu interrupt request dma service request m ensci loops te ptg2/txd txinv internal bus ? 4 pre- scaler scp1 scp0 scr2 scr1 scr0 baud divider ? 16
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 204 serial communications interface (sci) module motorola 3. clear the sci transmitter empty bit (scte) by reading sci status register 1 (scs1). 4. write the data to transmit into the scdr. 5. repeat steps 3 and 4 for each subsequent transmission. at the start of a transmission, transmitter control logic automatically loads the transmit shift register with a preamble of logic 1s. after the preamble shifts out, control logic transfers the scdr data into the transmit shift register. a logic 0 start bit automatically goes into the least significant bit (lsb) position of the transmit shift register. a logic 1 stop bit goes into the most significant bit (msb) position. the sci transmitter empty bit, scte, in scs1 becomes set when the scdr transfers a byte to the transmit shift register. the scte bit indicates that the scdr can accept new data from the internal data bus. if the sci transmit interrupt enable bit, sctie, in scc2 is also set, the scte bit generates an scte cpu interrupt request. when the transmit shift register is not transmitting a character, the ptg2/txd pin goes to the idle condition, logic 1. if at any time software clears the ensci bit in sci control register 1 (scc1), the transmitter and receiver relinquish control of the port e pins. 12.4.2.3 break characters writing a logic 1 to the send break bit, sbk, in scc2 loads the transmit shift register with a break character. a break character contains all logic 0s and has no start, stop, or parity bit. break character length depends on the m bit in scc1. as long as sbk is at logic 1, transmitter logic continuously loads break characters into the transmit shift register. after software clears the sbk bit, the shift register finishes transmitting the last break character and then transmits at least one logic 1. the automatic logic 1 at the end of a break character guarantees the recognition of the start bit of the next character.
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 205 non-disclosure agreement required the sci recognizes a break character when a start bit is followed by eight or nine logic 0 data bits and a logic 0 where the stop bit should be. receiving a break character has these effects on sci registers: ? sets the framing error flag, fe ? sets the sci receiver full flag, scrf ? clears the sci data register ? clears the received bit 8, r8 ? sets the break flag, bkf ? may set the overrun flag, or, noise flag, nf, parity error flag, pe, or the reception in progress flag, rpf 12.4.2.4 idle characters an idle character contains all logic 1s and has no start, stop, or parity bit. idle character length depends on the m bit in scc1. the preamble is a synchronizing idle character that begins every transmission. if the te bit is cleared during a transmission, the ptg2/txd pin becomes idle after completion of the transmission in progress. clearing and then setting the te bit during a transmission queues an idle character to be sent after the character currently being transmitted. note: when queueing an idle character, return the te bit to logic 1 before the stop bit of the current character shifts out to the ptg2/txd pin. setting te after the stop bit appears on ptg2/txd causes data previously written to the scdr to be lost. a good time to toggle the te bit is when the scte bit becomes set and just before writing the next byte to the scdr. 12.4.2.5 inversion of transmitted output the transmit inversion bit (txinv) in sci control register 1 (scc1) reverses the polarity of transmitted data. all transmitted values, including idle, break, start, and stop bits, are inverted when txinv is at logic 1. (see 12.8.1 sci control register 1 .)
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 206 serial communications interface (sci) module motorola 12.4.2.6 transmitter interrupts these conditions can generate cpu interrupt requests from the sci transmitter: ? sci transmitter empty (scte) the scte bit in scs1 indicates that the scdr has transferred a character to the transmit shift register. scte can generate an scte cpu interrupt request. setting the sci transmit interrupt enable bit, sctie, in scc2 enables scte cpu interrupts. ? transmission complete (tc) the tc bit in scs1 indicates that the transmit shift register and the scdr are empty and that no break or idle character has been generated. the sci transmitter interrupt enable bit, sctie, in scc2 enables tc cpu interrupt requests. 12.4.3 receiver figure 12-5 shows the structure of the sci receiver. 12.4.3.1 character length the receiver can accommodate either 8-bit or 9-bit data. the state of the m bit in sci control register 1 (scc1) determines character length. when receiving 9-bit data, bit r8 in sci control register 2 (scc2) is the ninth bit (bit 8). 12.4.3.2 character reception during an sci reception, the receive shift register shifts characters in from the ptg1/rxd pin. the sci data register (scdr) is the read-only buffer between the internal data bus and the receive shift register. after a complete character shifts into the receive shift register, the data portion of the character transfers to the scdr. the sci receiver full bit, scrf, in sci status register 1 (scs1) becomes set, indicating that the received byte can be read. if the sci receive interrupt enable bit, scrie, in scc2 is also set, the scrf bit generates an scrf cpu interrupt request.
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 207 non-disclosure agreement required figure 12-5. sci receiver block diagram all ones all zeros m wake ilty pen pty bkf rpf h876543210l 11-bit receive shift register stop start data recovery dmare scrf or orie nf neie fe feie pe peie dmare scrie scrf ilie idle wakeup logic parity checking msb error cpu interrupt request dma service request cpu interrupt request sci data register r8 dmare orie neie feie peie scrie ilie rwu sbk scrf idle or nf fe pe ptg1/rx internal bus pre- scaler baud divider ? 4 ? 16 scp1 scp0 scr2 scr1 scr0 clock source
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 208 serial communications interface (sci) module motorola 12.4.3.3 data sampling the receiver samples the ptg1/rxd pin at the rt clock rate. the rt clock is an internal signal with a frequency 16 times the baud-rate frequency. (see figure 12-6 .) ? start bit to locate the start bit, recovery logic does an asynchronous search for a logic 0 preceded by three logic 1s. when the falling edge of a possible start bit occurs, the rt clock begins to count to 16. ? to verify a valid start bit, data recovery logic takes samples at rt3, rt5, and rt7. if any two of these three samples are logic 1s, the rt clock is reset and the search for start bit begins again. if all three samples are logic 0s, start bit verification is successful. if only one of the three samples is logic 1, start bit verification is successful, but the noise flag (nf) becomes set. ? data bit to detect noise in data bits, recovery logic takes samples at rt8, rt9, and rt10 of every data bit time. if all three samples are not unanimous, the noise flag becomes set. ? stop bit to detect noise in stop bits, recovery logic takes samples at rt8, rt9, and rt10. if all three samples are not unanimous, the noise flag becomes set. figure 12-6. receiver data sampling rt clock reset rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt1 rt2 rt3 rt4 rt5 rt8 rt7 rt6 rt11 rt10 rt9 rt15 rt14 rt13 rt12 rt16 rt1 rt2 rt3 rt4 start bit qualification start bit verification data sampling samples rt clock rt clock state start bit lsb ptg1/rxd
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 209 non-disclosure agreement required to verify the start bit and to detect noise, data recovery logic takes samples at rt3, rt5, and rt7. table 12-1 summarizes the results of the start bit verification samples. if start bit verification is not successful, the rt clock is reset and a new search for a start bit begins. to determine the value of a data bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 12-2 summarizes the results of the data bit samples. note: the rt8, rt9, and rt10 samples do not affect start bit verification. if any or all of the rt8, rt9, and rt10 start bit samples are logic 1s table 12-1. start bit veri?cation rt3, rt5, and rt7 samples start bit verification noise flag 000 yes 0 001 yes 1 010 yes 1 011 no 0 100 yes 1 101 no 0 110 no 0 111 no 0 table 12-2. data bit recovery rt8, rt9, and rt10 samples data bit determination noise flag 000 0 0 001 0 1 010 0 1 011 1 1 100 0 1 101 1 1 110 1 1 111 1 0
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 210 serial communications interface (sci) module motorola following a successful start bit verification, the noise flag (nf) is set and the receiver assumes that the bit is a start bit. to verify a stop bit and to detect noise, recovery logic takes samples at rt8, rt9, and rt10. table 12-3 summarizes the results of the stop bit samples. 12.4.3.4 framing errors if the data recovery logic does not detect a logic 1 where the stop bit should be in an incoming character, it sets the framing error bit, fe, in scs1. a break character also sets the fe flag because a break character has no stop bit. the fe flag is set at the same time that the scrf bit is set. 12.4.3.5 baud rate tolerance a transmitting device may be operating at a baud rate below or above the receiver baud rate. accumulated bit time misalignment can cause one of the three stop bit data samples to fall outside the actual stop bit. then a noise error occurs. if more than one of the samples is outside the stop bit, a framing error occurs. in most applications, the baud rate tolerance is much more than the degree of misalignment that is likely to occur. table 12-3. stop bit recovery rt8, rt9, and rt10 samples framing error flag noise flag 000 1 0 001 1 1 010 1 1 011 0 1 100 1 1 101 0 1 110 0 1 111 0 0
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 211 non-disclosure agreement required as the receiver samples an incoming character, it resynchronizes the rt clock on any valid falling edge within the character. resynchronization within characters corrects misalignments between transmitter bit times and receiver bit times. slow data tolerance figure 12-7 shows how much a slow received character can be misaligned without causing a noise error or a framing error. the slow stop bit begins at rt8 instead of rt1 but arrives in time for the stop bit data samples at rt8, rt9, and rt10. figure 12-7. slow data for an 8-bit character, data sampling of the stop bit takes the receiver 9 bit times 16 rt cycles + 10 rt cycles = 154 rt cycles. with the misaligned character shown in figure 12-7 , the receiver counts 154 rt cycles at the point when the count of the transmitting device is 9 bit times 16 rt cycle s+3rt cycles = 147 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a slow 8-bit character with no errors is for a 9-bit character, data sampling of the stop bit takes the receiver 10 bit times 16 rt cycles + 10 rt cycles = 170 rt cycles. with the misaligned character shown in figure 12-7 , the receiver counts 170 rt cycles at the point when the count of the transmitting device is 10 bit times 16 rt cycle s+3rt cycles = 163 rt cycles. msb stop rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt9 rt10 rt11 rt12 rt13 rt14 rt15 rt16 data samples receiver rt clock 154 147 C 154 ------------------------- - 100 4.54% =
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 212 serial communications interface (sci) module motorola the maximum percent difference between the receiver count and the transmitter count of a slow 9-bit character with no errors is fast data tolerance figure 12-8 shows how much a fast received character can be misaligned without causing a noise error or a framing error. the fast stop bit ends at rt10 instead of rt16 but is still there for the stop bit data samples at rt8, rt9, and rt10. figure 12-8. fast data for an 8-bit character, data sampling of the stop bit takes the receiver 9 bit times 16 rt cycles + 10 rt cycles = 154 rt cycles. with the misaligned character shown in figure 12-8 , the receiver counts 154 rt cycles at the point when the count of the transmitting device is 10 bit times 16 rt cycles = 160 rt cycles. the maximum percent difference between the receiver count and the transmitter count of a fast 8-bit character with no errors is for a 9-bit character, data sampling of the stop bit takes the receiver 10 bit times 16 rt cycles + 10 rt cycles = 170 rt cycles. with the misaligned character shown in figure 12-8 , the receiver counts 170 rt cycles at the point when the count of the transmitting device is 11 bit times 16 rt cycles = 176 rt cycles. 170 163 C 170 ------------------------- - 100 4.12% = idle or next character stop rt1 rt2 rt3 rt4 rt5 rt6 rt7 rt8 rt9 rt10 rt11 rt12 rt13 rt14 rt15 rt16 data samples receiver rt clock 154 160 C 154 ------------------------- - 100 3.90% B =
serial communications interface (sci) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 213 non-disclosure agreement required the maximum percent difference between the receiver count and the transmitter count of a fast 9-bit character with no errors is 12.4.3.6 receiver wakeup so that the mcu can ignore transmissions intended only for other receivers in multiple-receiver systems, the mcu can be put into a standby state. setting the receiver wakeup bit, rwu, in scc2 puts the mcu into a standby state during which receiver interrupts are disabled. depending on the state of the wake bit in scc1, either of two conditions on the ptg1/rxd pin can bring the mcu out of the standby state: ? address mark an address mark is a logic 1 in the most significant bit position of a received character. when the wake bit is set, an address mark wakes the receiver from the standby state by clearing the rwu bit. the address mark also sets the sci receiver full flag, scrf. software can then compare the character containing the address mark to the user-defined address of the receiver. if they are the same, the receiver remains awake and processes the characters that follow. if they are not the same, software can set the rwu bit and put the receiver back into the standby state. ? idle input line condition when the wake bit is clear, an idle character on the rxd pin wakes the receiver from the standby state by clearing the rwu bit. the idle character that wakes the receiver does not set the receiver idle bit, idle, or the sci receiver full flag, scrf. the idle line type bit, ilty, determines whether the receiver begins counting logic 1s as idle character bits after the start bit or after the stop bit. note: with the wake bit clear, setting the rwu bit after the rxd pin has been idle may cause the receiver to wake up immediately. 170 176 C 170 ------------------------- - 100 3.53% =
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 214 serial communications interface (sci) module motorola 12.4.3.7 receiver interrupts these two sources can generate cpu interrupt requests from the sci receiver: ? sci receiver full (scrf) the scrf bit in scs1 indicates that the receive shift register has transferred a character to the scdr. scrf can generate an scrf cpu interrupt request or an scrf dma service request. setting the sci receive interrupt enable bit, scrie, in scc2 enables scrf cpu interrupts. setting both the scrie bit and the dma receive enable bit, dmare, in scc3 enables scrf dma service requests. ? idle input (idle) the idle bit in scs1 indicates that 10 or 11 consecutive logic 1s shifted in from the ptg1/rxd pin. the idle line interrupt enable bit, ilie, in scc2 enables idle cpu interrupts. 12.4.3.8 error interrupts the following receiver error conditions can generate cpu interrupt requests: ? receiver overrun (or) the or bit in scs1 indicates that the receive shift register shifted in a new character before the previous character was read from the scdr. the overrun interrupt enable bit, orie, in scc3 enables or cpu interrupts. ? noise flag (nf) the nf bit in scs1 is set when the sci detects noise on incoming data, including start, data, and stop bits. the noise error interrupt enable bit, neie, in scc3 enables nf cpu interrupts. ? framing error (fe) the fe bit in scs1 is set when a logic 0 occurs where the receiver expects a stop bit. the framing error interrupt enable bit, feie, in scc3 enables fe cpu interrupts. ? parity error (pe) the pe bit in scs1 is set when the sci detects a parity error in incoming data. the parity error interrupt enable bit, peie, in scc3 enables pe cpu interrupts.
serial communications interface (sci) module low-power modes mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 215 non-disclosure agreement required 12.5 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 12.5.1 wait mode the sci module remains active after the execution of a wait instruction. in wait mode, the sci module registers are not accessible by the cpu. any enabled cpu interrupt request from the sci module can bring the mcu out of wait mode. if sci module functions are not required during wait mode, reduce power consumption by disabling the module before executing the wait instruction. 12.5.2 stop mode the sci module is inactive after the execution of a stop instruction. the stop instruction does not affect sci register states. sci module operation resumes after an external interrupt. 12.6 sci during break interrupts the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. (see 7.8.3 sim break flag control register .) to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 216 serial communications interface (sci) module motorola the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. 12.7 i/o signals port e shares two of its pins with the sci module. the two sci i/o (input/output) pins are: ? ptg2/txd transmit data ? ptg1/rxd receive data 12.7.1 ptg2/txd (transmit data) the ptg2/txd pin is the serial data output from the sci transmitter. 12.7.2 ptg1/rxd (receive data) the ptg1/rxd pin is the serial data input to the sci receiver. 12.8 i/o registers the following i/o registers control and monitor sci operation: ? sci control register 1 (scc1) ? sci control register 2 (scc2) ? sci control register 3 (scc3) ? sci status register 1 (scs1) ? sci status register 2 (scs2) ? sci data register (scdr) ? sci baud rate register (scbr)
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 217 non-disclosure agreement required 12.8.1 sci control register 1 sci control register 1 (scc1): ? enables loop mode operation ? enables the sci ? controls output polarity ? controls character length ? controls sci wakeup method ? controls idle character detection ? enables parity function ? controls parity type loops loop mode select bit this read/write bit enables loop mode operation. in loop mode, the pte1/rxd pin is disconnected from the sci, and the transmitter output goes into the receiver input. both the transmitter and the receiver must be enabled to use loop mode. reset clears the loops bit. 1 = loop mode enabled 0 = normal operation enabled ensci enable sci bit this read/write bit enables the sci and the sci baud rate generator. clearing ensci sets the scte and tc bits in sci status register 1 and disables transmitter interrupts. reset clears the ensci bit. 1 = sci enabled 0 = sci disabled address: $0014 bit 7 654321 bit 0 read: loops ensci txinv m wake ilty pen pty write: reset: 00000000 figure 12-9. sci control register 1 (scc1)
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 218 serial communications interface (sci) module motorola txinv transmit inversion bit this read/write bit reverses the polarity of transmitted data. reset clears the txinv bit. 1 = transmitter output inverted 0 = transmitter output not inverted note: setting the txinv bit inverts all transmitted values, including idle, break, start, and stop bits. m mode (character length) bit this read/write bit determines whether sci characters are eight or nine bits long. (see table 12-4 .) the ninth bit can serve as an extra stop bit, as a receiver wakeup signal, or as a parity bit. reset clears the m bit. 1 = 9-bit sci characters 0 = 8-bit sci characters wake wakeup condition bit this read/write bit determines which condition wakes up the sci: a logic 1 (address mark) in the most significant bit position of a received character or an idle condition on the pte1/rxd pin. reset clears the wake bit. 1 = address mark wakeup 0 = idle line wakeup ilty idle line type bit this read/write bit determines when the sci starts counting logic 1s as idle character bits. the counting begins either after the start bit or after the stop bit. if the count begins after the start bit, then a string of logic 1s preceding the stop bit may cause false recognition of an idle character. beginning the count after the stop bit avoids false idle character recognition, but requires properly synchronized transmissions. reset clears the ilty bit. 1 = idle character bit count begins after stop bit. 0 = idle character bit count begins after start bit.
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 219 non-disclosure agreement required pen parity enable bit this read/write bit enables the sci parity function. (see table 12-4 .) when enabled, the parity function inserts a parity bit in the most significant bit position. (see figure 12-3 .) reset clears the pen bit. 1 = parity function enabled 0 = parity function disabled pty parity bit this read/write bit determines whether the sci generates and checks for odd parity or even parity. (see table 12-4 .) reset clears the pty bit. 1 = odd parity 0 = even parity table 12-4. character format selection control bits character format m pen:pty start bits data bits parity stop bits character length 0 0x 1 8 none 1 10 bits 1 0x 1 9 none 1 11 bits 0 10 1 7 even 1 10 bits 0 11 1 7 odd 1 10 bits 1 10 1 8 even 1 11 bits 1 11 1 8 odd 1 11 bits
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 220 serial communications interface (sci) module motorola 12.8.2 sci control register 2 sci control register 2 (scc2): ? enables the following interrupts: C transmitter interrupts C transmission complete interrupts C receiver interrupts C idle line interrupts ? enables the transmitter ? enables the receiver ? enables sci wakeup ? transmits sci break characters sctie sci transmit interrupt enable bit this read/write bit enables scte cpu interrupt requests or scte dma service requests. setting the sctie bit and clearing the dma transfer enable bit, dmate, in scc3 enables scte cpu interrupt requests. setting both the sctie and dmate bits enables scte dma service requests. reset clears the sctie bit. 1 = scte cpu interrupt requests or scte dma service requests enabled 0 = scte cpu interrupt requests or scte dma service requests disabled address: $0015 bit 7 654321 bit 0 read: sctie tcie scrie ilie te re rwu sbk write: reset: 00000000 figure 12-10. sci control register 2 (scc2)
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 221 non-disclosure agreement required tcie transmission complete interrupt enable bit this read/write bit enables tc cpu interrupt requests. reset clears the tcie bit. 1 = tc cpu interrupt requests enabled 0 = tc cpu interrupt requests disabled scrie sci receive interrupt enable bit this read/write bit enables scrf cpu interrupt requests or scrf dma service requests. setting the scrie bit and clearing the dma receive enable bit, dmare, in scc3 enables scrf cpu interrupt requests. setting both the scrie and dmare bits enables scrf dma service requests. reset clears the scrie bit. 1 = scrf cpu interrupt requests or scrf dma service requests enabled 0 = scrf cpu interrupt requests or scrf dma service requests disabled ilie idle line interrupt enable bit this read/write bit enables idle cpu interrupt requests when the idle bit becomes set. reset clears the ilie bit. 1 = idle cpu interrupts enabled 0 = idle cpu interrupts disabled te transmitter enable bit setting this read/write bit begins the transmission by sending a preamble of 10 or 11 logic 1s from the transmit shift register to the pte2/txd pin. if software clears the te bit, the transmitter completes any transmission in progress before the ptg2/txd returns to the idle condition (three-state). reset clears the te bit. 1 = transmission enabled 0 = transmission disabled re receiver enable bit setting this read/write bit enables the receiver. clearing the re bit disables the receiver but does not affect receiver interrupt flag bits. reset clears the re bit. 1 = receiver enabled 0 = receiver disabled
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 222 serial communications interface (sci) module motorola rwu receiver wakeup bit this read/write bit puts the receiver in a standby state during which receiver interrupts are disabled. typically, data transmitted to the receiver clears the rwu bit and returns the receiver to normal operation. the wake bit in scc1 determines whether an idle input or an address mark brings the receiver out of the standby state. reset clears the rwu bit. 1 = standby state 0 = normal operation sbk send break bit setting and then clearing this read/write bit transmits a break character followed by a logic 1. the logic 1 after the break character guarantees recognition of a valid start bit. if sbk remains set, the transmitter continuously transmits break characters with no logic 1s between them. reset clears the sbk bit. 1 = transmit break characters 0 = no break characters being transmitted 12.8.3 sci control register 3 sci control register 3 (scc3): ? stores the ninth sci data bit received and the ninth sci data bit to be transmitted ? enables sci receiver full (scrf) dma service requests ? enables sci transmitter empty (scte) dma service requests ? enables the following interrupts: C receiver overrun interrupts C noise error interrupts C framing error interrupts C parity error interrupts
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 223 non-disclosure agreement required r8 received bit 8 when the sci is receiving 9-bit characters, r8 is the read-only bit 8 of the received character. r8 is received at the same time that the scdr receives the other eight bits. reset has no effect on the r8 bit. t8 transmitted bit 8 when the sci is transmitting 9-bit characters, t8 is the read/write bit 8 of the transmitted character. t8 is loaded into the transmit shift register at the same time that the scdr is loaded into the transmit shift register. reset has no effect on the t8 bit. dmare dma receive enable bit this read/write bit enables sci receiver full (scrf) dma service requests. (see 12.8.4 sci status register 1 .) setting the dmare bit disables scrf cpu interrupt requests. reset clears the dmare bit. 1 = scrf dma service requests enabled (scrf cpu interrupt requests disabled) 0 = scrf dma service requests disabled (scrf cpu interrupt requests enabled) address: $0016 bit 7 654321 bit 0 read: r8 t8 dmare dmate orie neie feie peie write: reset: u u 000000 = unimplemented u = undetermined figure 12-11. sci control register 3 (scc3)
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 224 serial communications interface (sci) module motorola dmate dma transfer enable bit this read/write bit enables sci transmitter empty (scte) dma service requests. (see 12.8.4 sci status register 1 .) setting the dmate bit disables scte cpu interrupt requests. reset clears dmate. 1 = scte dma service requests enabled (scte cpu interrupt requests disabled) 0 = scte dma service requests disabled (scte cpu interrupt requests enabled) orie receiver overrun interrupt enable bit this read/write bit enables receiver overrun (or) cpu interrupt requests. (see 12.8.4 sci status register 1 .) reset clears orie. 1 = or cpu interrupt requests enabled 0 = or cpu interrupt requests disabled neie receiver noise error interrupt enable bit this read/write bit enables receiver noise error (ne) cpu interrupt requests. (see 12.8.4 sci status register 1 .) reset clears neie. 1 = ne cpu interrupt requests enabled 0 = ne cpu interrupt requests disabled feie receiver framing error interrupt enable bit this read/write bit enables receiver framing error (fe) cpu interrupt requests. (see 12.8.4 sci status register 1 .) reset clears feie. 1 = fe cpu interrupt requests enabled 0 = fe cpu interrupt requests disabled peie receiver parity error interrupt enable bit this read/write bit enables receiver parity error (pe) cpu interrupt requests. (see 12.8.4 sci status register 1 .) reset clears peie. 1 = pe cpu interrupt requests enabled 0 = pe cpu interrupt requests disabled
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 225 non-disclosure agreement required 12.8.4 sci status register 1 sci status register 1 (scs1) contains flags to signal these conditions: ? transfer of scdr data to transmit shift register complete ? transmission complete ? transfer of receive shift register data to scdr complete ? receiver input idle ? receiver overrun ? noisy data ? framing error ? parity error scte sci transmitter empty bit this clearable, read-only bit is set when the scdr transfers a character to the transmit shift register. scte can generate an scte cpu interrupt request or an scte dma service request. when the sctie bit in scc2 is set and the dmate bit in scc3 is clear, scte generates an scte cpu interrupt request. with both the sctie and dmate bits set, scte generates an scte dma service request. in normal operation, clear the scte bit by reading scs1 with scte set and then writing to scdr. in dma transfers, the dma automatically clears the scte bit when it writes to the scdr. reset sets the scte bit. 1 = scdr data transferred to transmit shift register 0 = scdr data not transferred to transmit shift register address: $0017 bit 7 654321 bit 0 read: scte tc scrf idle or nf fe pe write: reset: 11000000 = unimplemented figure 12-12. sci status register 1 (scs1)
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 226 serial communications interface (sci) module motorola tc transmission complete bit this clearable, read-only bit is set when the scte bit is set, and no data, preamble, or break character is being transmitted. tc generates a tc cpu interrupt request if the tcie bit in scc2 is also set. clear the tc bit by reading scs1 with tc set and then writing to the scdr. when the dma services an scte dma service request, the dma clears the tc bit by writing to the scdr. reset sets the tc bit. 1 = no transmission in progress 0 = transmission in progress scrf sci receiver full bit this clearable, read-only bit is set when the data in the receive shift register transfers to the sci data register. scrf can generate an scrf cpu interrupt request or an scrf dma service request. when the scrie bit in scc2 is set and the dmare bit in scc3 is clear, scrf generates an scrf cpu interrupt request. with both the scrie and dmare bits set, scrf generates an scrf dma service request. in normal operation, clear the scrf bit by reading scs1 with scrf set and then reading the scdr. in dma transfers, the dma clears the scrf bit when it reads the scdr. reset clears scrf. 1 = received data available in scdr 0 = data not available in scdr idle receiver idle bit this clearable, read-only bit is set when 10 or 11 consecutive logic 1s appear on the receiver input. idle generates an idle cpu interrupt request if the ilie bit in scc2 is also set. clear the idle bit by reading scs1 with idle set and then reading the scdr. once cleared, the idle bit can become set again only after the scrf bit becomes set and another idle character appears on the receiver input. reset clears the idle bit. 1 = receiver input idle 0 = receiver input active or idle since the idle bit was cleared
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 227 non-disclosure agreement required or receiver overrun bit this clearable, read-only bit is set when software fails to read the scdr before the receive shift register receives the next character. the or bit generates an or cpu interrupt request if the orie bit in scc3 is also set. the data in the shift register is lost, but the data already in the scdr is not affected. clear the or bit by reading scs1 with or set and then reading the scdr. reset clears the or bit. 1 = receive shift register full and scrf = 1 0 = no receiver overrun nf receiver noise flag bit this clearable, read-only bit is set when the sci detects noise on the ptg1/rxd pin. nf generates an nf cpu interrupt request if the neie bit in scc3 is also set. clear the nf bit by reading scs1 and then reading the scdr. reset clears the nf bit. 1 = noise detected 0 = no noise detected fe receiver framing error bit this clearable, read-only bit is set when a logic 0 occurs during a stop bit time. fe generates an fe cpu interrupt request if the feie bit in scc3 also is set. clear the fe bit by reading scs1 with fe set and then reading the scdr. reset clears the fe bit. 1 = framing error detected 0 = no framing error detected pe receiver parity error bit this clearable, read-only bit is set when the sci detects a parity error in incoming data. pe generates a pe cpu interrupt request if the peie bit in scc3 is also set. clear the pe bit by reading scs1 with pe set and then reading the scdr. reset clears the pe bit. 1 = parity error detected 0 = no parity error detected
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 228 serial communications interface (sci) module motorola 12.8.5 sci status register 2 sci status register 2 (scs2) contains flags to signal these conditions: ? break character detected ? incoming data bkf break flag bit this clearable, read-only bit is set when the sci detects a break character on the ptg1/rxd pin. bkf does not generate an interrupt request. clear bkf by reading scs2 with bkf set and then reading the scdr. once cleared, bkf can become set again only after logic 1s again appear on the ptg1/rxd pin followed by another break character. reset clears the bkf bit. 1 = break character detected 0 = no break character detected rpf reception in progress flag bit this read-only bit is set during the rt1 time period of the start bit search. rpf does not generate an interrupt request. rpf is reset after the stop bit or when the sci detects false start bits, usually from noise or a baud rate mismatch. polling rpf before disabling the sci module or entering stop mode can show whether a reception is in progress. 1 = reception in progress 0 = no reception in progress address: $0018 bit 7 654321 bit 0 read: bkf rpf write: reset: 00000000 = unimplemented figure 12-13. sci status register 2 (scs2)
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 229 non-disclosure agreement required 12.8.6 sci data register the sci data register (scdr) is the buffer between the internal data bus and the receive and transmit shift registers. reset has no effect on data in the sci data register. r7/t7Cr0/t0 receive/transmit data bits reading scdr accesses the read-only received data bits, r7Cr0. writing to scdr writes the data to be transmitted, t7Ct0. reset has no effect on the sci data register. 12.8.7 sci baud rate register the baud rate register (scbr) selects the baud rate for both the receiver and the transmitter. address: $0019 bit 7 654321 bit 0 read: r7 r6 r5 r4 r3 r2 r1 r0 write: t7 t6 t5 t4 t3 t2 t1 t0 reset: unaffected by reset figure 12-14. sci data register (scdr) address: $001a bit 7 654321 bit 0 read: scp1 scp0 scr2 scr1 scr0 write: reset: 00000000 = unimplemented figure 12-15. sci baud rate register (scbr)
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 230 serial communications interface (sci) module motorola scp1 and scp0 sci baud rate prescaler bits these read/write bits select the baud rate prescaler divisor as shown in table 12-5 . reset clears scp1 and scp0. rchk sci rate check this bit is only available in test mode. setting this bit enables the transmitter clock to be visible on the transmit data pin instead of the transmit data. scr2Cscr0 sci baud rate select bits these read/write bits select the sci baud rate divisor as shown in table 12-6 . reset clears scr2Cscr0. table 12-5. sci baud rate prescaling scp1 and scp0 prescaler divisor (pd) 00 1 01 3 10 4 11 13 table 12-6. sci baud rate selection scr2, scr1, and scr0 baud rate divisor (bd) 000 1 001 2 010 4 011 8 100 16 101 32 110 64 111 128
serial communications interface (sci) module i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola serial communications interface (sci) module 231 non-disclosure agreement required use this formula to calculate the sci baud rate: where: cgmout ? 2 = bus frequency pd = prescaler divisor bd = baud rate divisor sci_bdsrc is an input to the sci. normally, it will be tied off low at the top level to select cgmxlck as the clock source. if it is tied off high, it will select it12 as the clock source. this makes the formula: table 12-7 shows the sci baud rates that can be generated with a 4.9152-mhz crystal. baud rate cgmout 2 ? 64 pd bd ------------------------------------ = baud rate it12 64 pd bd ------------------------------------ =
non-disclosure agreement required serial communications interface (sci) module advance information mc68hc(9)08pt48 rev. 2.0 232 serial communications interface (sci) module motorola table 12-7. sci baud rate selection examples scp1 and scp0 prescaler divisor (pd) scr2, scr1, and scr0 baud rate divisor (bd) baud rate (cgmxclk ? 2 = 0.8192 mhz) 00 1 000 1 12,800 00 1 001 2 6400 00 1 010 4 3200 00 1 011 8 1600 00 1 100 16 800 00 1 101 32 400 00 1 110 64 200 00 1 111 128 100 01 3 000 1 4267 01 3 001 2 2133 01 3 010 4 1067 01 3 011 8 533 01 3 100 16 267 01 3 101 32 133 01 3 110 64 67 01 3 111 128 33 10 4 000 1 3200 10 4 001 2 1600 10 4 010 4 800 10 4 011 8 400 10 4 100 16 200 10 4 101 32 100 10 4 110 64 50 10 4 111 128 25 11 13 000 1 984 11 13 001 2 492 11 13 010 4 246 11 13 011 8 123 11 13 100 16 62 11 13 101 32 31 11 13 110 64 15 11 13 111 128 8
mc68hc(9)08pt48 rev. 2.0 advance information motorola analog-to-digital converter (adc) module 233 non-disclosure agreement required advance information mc68hc(9)08pt48 section 13. analog-to-digital converter (adc) module 13.1 contents 13.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 13.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4.1 adc port i/o pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 13.4.2 voltage conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 13.4.3 conversion time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.4.4 conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.4.5 accuracy and precision. . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 13.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.7 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 13.7.1 adc analog power pin (v dda2 ) . . . . . . . . . . . . . . . . . . . .237 13.7.2 adc analog ground pin (v ssa2 ) . . . . . . . . . . . . . . . . . . .238 13.7.3 adc voltage reference pin (v rh ) . . . . . . . . . . . . . . . . . .238 13.7.4 adc voltage in (advin) . . . . . . . . . . . . . . . . . . . . . . . . . .238 13.8 input/output registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .238 13.8.1 adc status and control register . . . . . . . . . . . . . . . . . . .238 13.8.2 adc data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241 13.8.3 adc clock register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241 13.2 introduction this section describes the 8-bit analog-to-digital converter (adc).
non-disclosure agreement required analog-to-digital converter (adc) module advance information mc68hc(9)08pt48 rev. 2.0 234 analog-to-digital converter (adc) module motorola 13.3 features features include: ? four channels with multiplexed input ? linear successive approximation ? 8-bit resolution ? single or continous conversion ? conversion complete flag or conversion complete interrupt ? selectable adc clock 13.4 functional description four pins for sampling external sources are located at pins pte7/ad3Cpte4/ad0. an analog multiplexer allows the single adc to select one of four adc channels as adc voltage input (advin). advin is converted by the successive approximation register based adc. when the conversion is completed, adc places the result in the adc data register and sets a flag or generates an interrupt. (see figure 13-1 .) note: references to dma and associated functions are only valid if the mcu has a dma module. if the mcu has no dma, any dma-related register bits should be left in their reset state for expected mcu operation. 13.4.1 adc port i/o pins pte7/ad3Cpte4/ad0 are general-purpose input/output (i/o) pins that share with the adc channels. the channel select bits define which adc channel/port pin will be used as the input signal. the adc overrides the port i/o logic by forcing that pin as input to the adc. the remaining adc channels/port pins are controlled by the port i/o logic and can be used as general-purpose i/o. writes to the port register or data direction register (ddr) will not have any effect on the port pin that is selected by the adc. a read of a port pin which is in use by the adc will return a logic 0.
analog-to-digital converter (adc) module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola analog-to-digital converter (adc) module 235 non-disclosure agreement required figure 13-1. adc block diagram 13.4.2 voltage conversion when the input voltage to the adc equals v rh , the adc converts the signal to $ff (full scale). if the input voltage equals av ss , the adc converts it to $00. input voltages between v rh and av ss are a straight- line linear conversion. all other input voltages will result in $ff, if greater than v rh . note: input voltage should not exceed the analog supply voltages. internal data bus read ddre write ddre reset write pte read pte ptex ddrex ptex interrupt logic adc clock generator conversion complete adc voltage in (advin) adc clock cgmxclk bus clock adch[4:0] adc data register adiv[2:0] adiclk aien coco/idmas disable disable (adc channel x) channel select
non-disclosure agreement required analog-to-digital converter (adc) module advance information mc68hc(9)08pt48 rev. 2.0 236 analog-to-digital converter (adc) module motorola 13.4.3 conversion time conversion starts after a write to the adc status and control register (adscr). conversion time in terms of the number of bus cycles is a function of oscillator frequency, bus frequency, and adiv prescaler bits. for example, with bus frequency of 4 mhz and adc clock frequency of 1 mhz, one conversion will take between 16 adc and 17 adc clock cycles or between 16 m s and 17 m s. there will be 128 bus cycles between each conversion. sample rate is approximately 30 khz. 13.4.4 conversion in the continuous conversion mode, the adc data register (adr) will be filled with new data after each conversion. data from the previous conversion will be overwritten whether that data has been read or not. conversions will continue until the adco bit is cleared. the coco/idmas bit is set after the first conversion and will stay set until the next write of the adscr or the next read of the adr. in the single conversion mode, conversion begins with a write to the adscr. only one conversion occurs between writes to the adscr. 13.4.5 accuracy and precision the conversion process is monotonic and has no missing codes. 13.5 interrupts when the aien bit is set, the adc module is capable of generating either cpu or dma interrupts after each adc conversion. a cpu interrupt is generated if the coco/idmas bit is at logic 0. if coco/idmas bit is set, a dma interrupt is generated. the conversion time = 16C17 adc cycles adc frequency # bus cycles = conversion time x bus frequency
analog-to-digital converter (adc) module low-power modes mc68hc(9)08pt48 rev. 2.0 advance information motorola analog-to-digital converter (adc) module 237 non-disclosure agreement required coco/idmas bit is not used as a conversion complete flag when interrupts are enabled. 13.6 low-power modes the wait and stop instruction can put the mcu in low power- consumption standby modes. 13.6.1 wait mode the adc continues normal operation during wait mode. any enabled cpu interrupt request from the adc can bring the mcu out of wait mode. if the adc is not required to bring the mcu out of wait mode, power down the adc by setting adch4Cadch0 bits in the adscr before executing the wait instruction. 13.6.2 stop mode the adc module is inactive after the execution of a stop instruction. any pending conversion is aborted. adc conversions resume when the mcu exits stop mode after an external interrupt. allow one conversion cycle to stabilize the analog circuitry. 13.7 i/o signals the adc module has four pins shared with port e. 13.7.1 adc analog power pin (v dda2 ) the adc analog portion uses av dd as its power pin. connect the v dda2 pin to the same voltage potential as v dd . external filtering may be necessary to ensure clean v dda2 for good results. note: route av dd carefully for maximum noise immunity and place bypass capacitors as close as possible to the package.
non-disclosure agreement required analog-to-digital converter (adc) module advance information mc68hc(9)08pt48 rev. 2.0 238 analog-to-digital converter (adc) module motorola 13.7.2 adc analog ground pin (v ssa2 ) the adc analog portion uses av ss as its ground pin. connect the v ssa2 pin to the same voltage potential as v ss . 13.7.3 adc voltage reference pin (v rh ) v rh is the power supply for setting the reference voltage v rh . connect the v rh pin to a voltage potential <= v dda2 , not less than 1.5 v. 13.7.4 adc voltage in (advin) advin is the input voltage signal from one of the four adc channels to the adc module. 13.8 input/output registers these i/o registers control and monitor operation of the adc: ? adc status and control register (adscr) ? adc data register (adr) ? adc clock register (adclk) 13.8.1 adc status and control register the function of the adc status and control register (adscr) is described here. address $004c bit 7 654321 bit 0 read: coco/ idmas aien adco adch4 adch3 adch2 adch1 adch0 write: reset: 00011111 figure 13-2. adc status and control register (adscr)
analog-to-digital converter (adc) module input/output registers mc68hc(9)08pt48 rev. 2.0 advance information motorola analog-to-digital converter (adc) module 239 non-disclosure agreement required coco/idmas conversions complete/interrupt dma select when aien bit is a logic 0, the coco/idmas is a read-only bit which is set each time a conversion is completed except in the continous conversion mode where it is set after the first conversion. this bit is cleared whenever the adscr is written or whenever the adr is read. if aien bit is a logic 1, the coco/idmas is a read/write bit which selects either cpu or dma to service the adc interrupt request. reset clears this bit. 1 = conversion completed (aien = 0)/dma interrrupt (aien = 1) 0 = conversion not completed (aien = 0)/cpu interrupt (aien = 1) aien adc interrupt enable when this bit is set, an interrupt is generated at the end of an adc conversion. the interrupt signal is cleared when the adr is read or the adscr is written. reset clears aien bit. 1 = adc interrupt enabled 0 = adc interrupt disabled adco adc continuous conversion when set, the adc will continuously convert samples and update the adr at the end of each conversion. only one conversion is completed between writes to the adscr when this bit is cleared. reset clears the adco bit. 1 = continuous adc conversion 0 = one adc conversion adch4Cadch0 adc channel select bits adch4Cadch0 form a 5-bit field which is used to select one of 16 adc channels. only four channels, adch3Cadch0, are avaliable on this mcu. the channels are detailed in table 13-1 . care should be taken when using a port pin as both an analog and digital input simultaneously to prevent switching noise from corrupting the analog signal. the adc subsystem is turned off when the channel select bits are all set to 1. this feature allows for reduced power consumption for the mcu when the adc is not being used.
non-disclosure agreement required analog-to-digital converter (adc) module advance information mc68hc(9)08pt48 rev. 2.0 240 analog-to-digital converter (adc) module motorola note: recovery from the disabled state requires one conversion cycle to stabilize. the voltage levels supplied from internal reference nodes as specified in table 13-1 are used to verify the operation of the adc converter both in production test and for user applications. table 13-1. mux channel select adch4 adch3 adch2 adch1 adch0 input select 00000 pte4/ad0 00001 pte5/ad1 00010 pte6/ad2 00011 pte7/ad3 00100 reserved reserved 11011 reserved 1 1 1 0 0 v rh 1 1 1 0 1 v rh 1 1 1 1 0 av ss 1 1 1 1 1 adc power off note: if any unused channels are selected, the resulting adc conversion will be unknown.
analog-to-digital converter (adc) module input/output registers mc68hc(9)08pt48 rev. 2.0 advance information motorola analog-to-digital converter (adc) module 241 non-disclosure agreement required 13.8.2 adc data register one 8-bit result register, adc data register (adr), is provided. this register is updated each time an adc conversion completes. 13.8.3 adc clock register the adc clock register (adclkr) selects the clock frequency for the adc. adiv2Cadiv0 adc clock prescaler bits adiv2, adiv1, and adiv0 form a 3-bit field which selects the divide ratio used by the adc to generate the internal adc clock. table 13-2 shows the available clock configurations. the adc clock should be set to approximately 1 mhz. address $004d bit 7 654321 bit 0 read: ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 write: reset: 00000000 = unimplemented figure 13-3. adc data register (adr) address $004e bit 7 654321 bit 0 read: adiv2 adiv1 adiv0 adiclk 0000 write: reset: 00000000 = unimplemented figure 13-4. adc clock register (adclkr)
non-disclosure agreement required analog-to-digital converter (adc) module advance information mc68hc(9)08pt48 rev. 2.0 242 analog-to-digital converter (adc) module motorola adiclk adc input clock select adiclk selects either bus clock or cgmxclk as the input clock source to generate the internal adc clock. reset selects cgmxclk as the adc clock source. if the external clock (cgmxclk) is equal or greater than 1 mhz, cgmxclk can be used as the clock source for the adc. if cgmxclk is less than 1 mhz, use the pll-generated bus clock as the clock source. as long as the internal adc clock is at approximately 1 mhz, correct operation can be guaranteed. 1 = internal bus clock 0 = external clock (cgmxclk) table 13-2. adc clock divide ratio adiv2 adiv1 adiv0 adc clock rate 0 0 0 adc input clock ? 1 0 0 1 adc input clock ? 2 0 1 0 adc input clock ? 4 0 1 1 adc input clock ? 8 1 x x adc input clock ? 16 x = dont care 1 mhz adc input clock frequency adiv 2:0 [] ---------------------------------------------------------------------- =
mc68hc(9)08pt48 rev. 2.0 advance information motorola configuration register (config) 243 non-disclosure agreement required advance information mc68hc(9)08pt48 section 14. configuration register (config) 14.1 contents 14.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243 14.3 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243 14.2 introduction this section describes the configuration register (config). the configuration register enables or disables the following options: ? stop mode recovery time (32 oscxclk cycles or 4096 oscxclk cycles) ? stop instruction ? computer operating properly module (cop) ? sci clock source select (scibdsrc) 14.3 functional description the configuration register is used in the initialization of various options. the configuration register can be written once after each reset. since the various options affect the operation of the mcu, it is recommended that this register be written immediately after reset. the configuration register is located at $003f. for compatibility, a write to a rom version of the mcu at this location will have no effect. the configuration register may be read at any time.
non-disclosure agreement required con?guration register (config) advance information mc68hc(9)08pt48 rev. 2.0 244 configuration register (config) motorola note: the config module is known as an mor (mask option register) on a rom device. (see figure 14-2 .) for references in the documentation which refer to the mor, the config would be applicable for the flash version of the device. ssrec short stop recovery bit ssrec enables the cpu to exit stop mode with a delay of 32 oscxclk cycles instead of a 4096-oscxclk cycle delay. 1 = stop mode recovery after 32 oscxclk cycles 0 = stop mode recovery after 4096 oscxclk cycles note: exiting stop mode by pulling reset will result in the long stop recovery. if using an external crystal, do not set the ssrec bit. scibdsrc sci clock select 1 = sci clock selects it12 0 = sci clock selects cgmxclk address $003f bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 ssrec scibdsrc 0 stop copd write: reset: 0000 1 000 = unimplemented figure 14-1. configuration register (config) address $003f bit 7 6 5 4 3 2 1 bit 0 read: 0 0 0 ssrec scibdsrc sec stop copd write: reset: 0 0 0 x x x x x = unimplemented x = indeterminate figure 14-2. mask option register (mor)
configuration register (config) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola configuration register (config) 245 non-disclosure agreement required sec rom security bit 1 = rom security enabled 0 = rom security disabled note: this bit is not valid on the mc68hc908pt48. stop enables the stop instruction 1 = stop instruction enabled 0 = stop instruction treated as illegal opcode copd cop disable bit copd disables the cop module. (see section 5. computer operating properly (cop) module .) 1 = cop module disabled 0 = cop module enabled
non-disclosure agreement required con?guration register (config) advance information mc68hc(9)08pt48 rev. 2.0 246 configuration register (config) motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 247 non-disclosure agreement required advance information mc68hc(9)08pt48 section 15. timer interface module (tim) 15.1 contents 15.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 15.4.1 timer counter prescaler . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.2 input capture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.3 output compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 15.4.3.1 unbuffered output compare . . . . . . . . . . . . . . . . . . . . .252 15.4.3.2 buffered output compare . . . . . . . . . . . . . . . . . . . . . . .253 15.4.4 pulse width modulation (pwm) . . . . . . . . . . . . . . . . . . . .254 15.4.4.1 unbuffered pwm signal generation . . . . . . . . . . . . . . .255 15.4.4.2 buffered pwm signal generation . . . . . . . . . . . . . . . . .256 15.4.4.3 pwm initialization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257 15.5 interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.6.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 15.7 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . . . . .260 15.8 i/o signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260 15.8.1 tim clock pin (ptg3/tclk) . . . . . . . . . . . . . . . . . . . . . . .261 15.8.2 timer channel i/o pins (ptg4/tch0Cptg7/tch3) . . . .261 15.9 i/o registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 15.9.1 timer status and control register . . . . . . . . . . . . . . . . . .262 15.9.2 timer counter registers . . . . . . . . . . . . . . . . . . . . . . . . .264 15.9.3 timer modulo registers . . . . . . . . . . . . . . . . . . . . . . . . . .265 15.9.4 timer channel status and control registers . . . . . . . . . .266 15.9.5 timer channel registers. . . . . . . . . . . . . . . . . . . . . . . . . .271
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 248 timer interface module (tim) motorola 15.2 introduction this section describes the timer interface module (tim, version b). the tim is a 4-channel timer that provides a timing reference with input capture, output compare, and pulse-width-modulation functions. figure 15-1 is a block diagram of the tim. 15.3 features features of the tim include: ? modular architecture ? four input capture/output compare channels C rising-edge, falling-edge, or any-edge input capture trigger C set, clear, or toggle output compare action ? buffered and unbuffered pulse width modulation (pwm) signal generation ? programmable tim clock input C 7-frequency internal bus clock prescaler selection C external tim clock input (2-mhz maximum frequency) ? free-running or modulo up-count operation ? toggle any channel pin on overflow ? timer counter stop and reset bit 15.4 functional description figure 15-1 shows the structure of the tim. the central component of the tim is the 16-bit timer counter that can operate as a free-running counter or a modulo up-counter. the timer counter provides the timing reference for the input capture and output compare functions. the timer counter modulo registers, tmodh:tmodl, control the modulo value of the timer counter. software can read the timer counter value at any time without affecting the counting sequence. the four tim channels are programmable independently as input capture or output compare channels.
timer interface module (tim) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 249 non-disclosure agreement required figure 15-1. tim block diagram prescaler prescaler select tclk internal 16-bit comparator ps2 ps1 ps0 16-bit comparator 16-bit latch tch0h:tch0l ms0a els0b els0a ptg4 tof toie inter- 16-bit comparator 16-bit latch tch1h:tch1l 16-bit comparator 16-bit latch tch2h:tch2l 16-bit comparator 16-bit latch tch3h:tch3l channel 0 channel 1 channel 2 channel 3 tmodh:tmodl trst tstop tov0 ch0ie dma0s ch0f els1b els1a tov1 ch1ie dma1s ch1max ch1f els2b els2a tov2 ch2ie dma2s ch2max ch2f els3b els3a tov3 ch3ie dma3s ch3max ch3f ch0max ms0b ms2b 16-bit counter internal bus bus clock ms1a ms2a ms3a tclk tch0 tch1 tch2 tch3 logic rupt logic inter- rupt logic ptg5 logic inter- rupt logic ptg6 logic inter- rupt logic ptg7 logic inter- rupt logic
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 250 timer interface module (tim) motorola addr. register name bit 7 6 5 4 3 2 1 bit 0 $0020 timer status and control register (tsc) read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst reset: 0 0 1 0 0 0 0 0 $0022 timer counter register high (tcnth) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0023 timer counter register low (tcntl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $0024 timer modulo register high (tmodh) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 1 1 1 1 1 1 1 1 $0025 timer modulo register low (tmodl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 1 1 1 1 1 1 1 1 $0026 timer channel 0 status and control register (tsc0) read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset: 0 0 0 0 0 0 0 0 $0027 timer channel 0 register high (tch0h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $0028 timer channel 0 register low (tch0l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset $0029 timer channel 1 status and control register (tsc1) read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset: 0 0 0 0 0 0 0 0 = unimplemented figure 15-2. timer i/o register summary
timer interface module (tim) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 251 non-disclosure agreement required $002a timer channel 1 register high (tch1h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset $002b timer channel 1 register low (tch1l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset $002c timer channel 2 status and control register (tsc2) read: ch2f ch2ie ms2b ms2a els2b els2a tov2 ch2max write: 0 reset: 0 0 0 0 0 0 0 0 $002d timer channel 2 register high (tch2h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: unaffected by reset $002e timer channel 2 register low (tch2l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset $002f timer channel 3 status and control register (tsc3) read: ch3f ch3ie 0 ms3a els3b els3a tov3 ch3max write: 0 reset: 0 0 0 0 0 0 0 0 $0030 timer channel 3 register high (tch3h) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: unaffected by reset $0031 timer channel 3 register low (tch3l) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: unaffected by reset addr. register name bit 7 6 5 4 3 2 1 bit 0 = unimplemented figure 15-2. timer i/o register summary (continued)
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 252 timer interface module (tim) motorola 15.4.1 timer counter prescaler the tim clock source can be one of the seven prescaler outputs or the tim clock pin, ptg3/tclk. the prescaler generates seven clock rates from the internal bus clock. the prescaler select bits, ps2Cps0, in the timer status and control register select the tim clock source. 15.4.2 input capture with the input capture function, the tim can capture the time at which an external event occurs. when an active edge occurs on the pin of an input capture channel, the tim latches the contents of the timer counter into the timer channel registers, tchxh:tchxl. the polarity of the active edge is programmable. input capture latency can be up to three bus clock cycles. input captures can generate tim cpu interrupt requests. 15.4.3 output compare with the output compare function, the tim can generate a periodic pulse with a programmable polarity, duration, and frequency. when the counter reaches the value in the registers of an output compare channel, the tim can set, clear, or toggle the channel pin. output compares can generate tim cpu interrupt requests or tim dma service requests. 15.4.3.1 unbuffered output compare any output compare channel can generate unbuffered output compare pulses as described in 15.4.3 output compare . the pulses are unbuffered because changing the output compare value requires writing the new value over the old value currently in the timer channel registers. an unsynchronized write to the timer channel registers to change an output compare value could cause incorrect operation for up to two counter overflow periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that counter overflow period. also, using a timer overflow interrupt routine to write a new, smaller output
timer interface module (tim) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 253 non-disclosure agreement required compare value may cause the compare to be missed. the timer may pass the new value before it is written. use these methods to synchronize unbuffered changes in the output compare value on channel x: ? when changing to a smaller value, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current output compare pulse. the interrupt routine has until the end of the counter overflow period to write the new value. ? when changing to a larger output compare value, enable channel x timer overflow interrupts and write the new value in the timer overflow interrupt routine. the timer overflow interrupt occurs at the end of the current counter overflow period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same counter overflow period. 15.4.3.2 buffered output compare channels 0 and 1 can be linked to form a buffered output compare channel whose output appears on the ptg4/tch0 pin. the timer channel registers of the linked pair alternately control the output. setting the ms0b bit in timer channel 0 status and control register (tsc0) links channel 0 and channel 1. the output compare value in the timer channel 0 registers initially controls the output on the ptg4/tch0 pin. writing to the timer channel 1 registers enables the timer channel 1 registers to synchronously control the output after the timer overflows. at each subsequent overflow, the timer channel registers (0 or 1) that control the output are the ones written to last. tsc0 controls and monitors the buffered output compare function, and timer channel 1 status and control register (tsc1) is unused. while the ms0b bit is set, the channel 1 pin, ptg5/tch1, is available as a general-purpose i/o pin.
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 254 timer interface module (tim) motorola channels 2 and 3 can be linked to form a buffered output compare channel whose output appears on the ptg6/tch2 pin. the timer channel registers of the linked pair alternately control the output. setting the ms2b bit in timer channel 2 status and control register (tsc2) links channel 2 and channel 3. the output compare value in the timer channel 2 registers initially controls the output on the ptg6/tch2 pin. writing to the timer channel 3 registers enables the timer channel 3 registers to synchronously control the output after the timer overflows. at each subsequent overflow, the timer channel registers (2 or 3) that control the output are the ones written to last. tsc2 controls and monitors the buffered output compare function, and timer channel 3 status and control register (tsc3) is unused. in buffered output compare operation, do not write new output compare values to the currently active channel registers. writing to the active channel registers is the same as generating unbuffered output compares. 15.4.4 pulse width modulation (pwm) by using the toggle-on-overflow feature with an output compare channel, the tim can generate a pwm signal. the value in the timer counter modulo registers determines the period of the pwm signal. the channel pin toggles when the counter reaches the value in the timer counter modulo registers. the time between overflows is the period of the pwm signal. as figure 15-3 shows, the output compare value in the timer channel registers determines the pulse width of the pwm signal. the time between overflow and output compare is the pulse width. program the tim to clear the channel pin on output compare if the state of the pwm pulse is logic 1. program the tim to set the pin if the state of the pwm pulse is logic 0. the value in the timer counter modulo registers and the selected prescaler output determine the frequency of the pwm output. the frequency of an 8-bit pwm signal is variable in 256 increments. writing $00ff (255) to the timer counter modulo registers produces a pwm period of 256 times the internal bus clock period.
timer interface module (tim) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 255 non-disclosure agreement required figure 15-3. pwm period and pulse width the value in the timer channel registers determines the pulse width of the pwm output. the pulse width of an 8-bit pwm signal is variable in 256 increments. writing $0080 (128) to the timer channel registers produces a duty cycle of 128/256 or 50 percent. 15.4.4.1 unbuffered pwm signal generation any output compare channel can generate unbuffered pwm pulses as described in 15.4.4 pulse width modulation (pwm) . the pulses are unbuffered because changing the pulse width requires writing the new pulse width value over the old value currently in the timer channel registers. an unsynchronized write to the timer channel registers to change a pulse width value could cause incorrect operation for up to two pwm periods. for example, writing a new value before the counter reaches the old value but after the counter reaches the new value prevents any compare during that pwm period. also, using a timer overflow interrupt routine to write a new, smaller pulse width value may cause the compare to be missed. the timer may pass the new value before it is written. ptgx/tchx period pulse width overflow overflow overflow output compare output compare output compare
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 256 timer interface module (tim) motorola use these methods to synchronize unbuffered changes in the pwm pulse width on channel x: ? when changing to a shorter pulse width, enable channel x output compare interrupts and write the new value in the output compare interrupt routine. the output compare interrupt occurs at the end of the current pulse. the interrupt routine has until the end of the pwm period to write the new value. ? when changing to a longer pulse width, enable channel x timer overflow interrupts and write the new value in the timer overflow interrupt routine. the timer overflow interrupt occurs at the end of the current pwm period. writing a larger value in an output compare interrupt routine (at the end of the current pulse) could cause two output compares to occur in the same pwm period. note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare also can cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 15.4.4.2 buffered pwm signal generation channels 0 and 1 can be linked to form a buffered pwm channel whose output appears on the ptg4/tch0 pin. the timer channel registers of the linked pair alternately control the pulse width of the output. setting the ms0b bit in timer channel 0 status and control register (tsc0) links channel 0 and channel 1. the timer channel 0 registers initially control the pulse width on the ptg4/tch0 pin. writing to the timer channel 1 registers enables the timer channel 1 registers to synchronously control the pulse width at the beginning of the next pwm period. at each subsequent overflow, the timer channel registers (0 or 1) that control the pulse width are written to last. tsc0 controls and monitors the buffered pwm function, and timer channel 1 status and control register (tsc1) is unused. while the ms0b bit is set, the channel 1 pin, ptg5/tch1, is available as a general-purpose i/o pin.
timer interface module (tim) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 257 non-disclosure agreement required channels 2 and 3 can be linked to form a buffered pwm channel whose output appears on the ptg6/tch2 pin. the timer channel registers of the linked pair alternately control the pulse width of the output. setting the ms2b bit in timer channel 2 status and control register (tsc2) links channel 2 and channel 3. the timer channel 2 registers initially control the pulse width on the ptg6/tch2 pin. writing to the timer channel 3 registers enables the timer channel 3 registers to synchronously control the pulse width at the beginning of the next pwm period. at each subsequent overflow, the timer channel registers (2 or 3) that control the pulse width are the ones written to last. tsc2 controls and monitors the buffered pwm function, and timer channel 3 status and control register (tsc3) is unused. note: in buffered pwm signal generation, do not write new pulse width values to the currently active channel registers. writing to the active channel registers is the same as generating unbuffered pwm signals. 15.4.4.3 pwm initialization to ensure correct operation when generating unbuffered or buffered pwm signals, use this initialization procedure: 1. in the timer status and control register (tsc): a. stop the timer counter by setting the timer stop bit, tstop. b. reset the timer counter by setting the timer reset bit, trst. 2. in the timer counter modulo registers (tmodh:tmodl), write the value for the required pwm period. 3. in the timer channel x registers (tchxh:tchxl), write the value for the required pulse width. 4. in timer channel x status and control register (tscx): a. write 0:1 (for unbuffered output compare or pwm signals) or 1:0 (for buffered output compare or pwm signals) to the mode select bits, msxb:msxa. (see table 15-2 .) b. write 1 to the toggle-on-overflow bit, tovx.
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 258 timer interface module (tim) motorola c. write 1:0 (to clear output on compare) or 1:1 (to set output on compare) to the edge/level select bits, elsxb:elsxa. the output action on compare must force the output to the complement of the pulse width level. (see table 15-2 .) note: in pwm signal generation, do not program the pwm channel to toggle on output compare. toggling on output compare prevents reliable 0 percent duty cycle generation and removes the ability of the channel to self-correct in the event of software error or noise. toggling on output compare can also cause incorrect pwm signal generation when changing the pwm pulse width to a new, much larger value. 5. in the timer status control register (tsc), clear the timer stop bit, tstop. setting ms0b links channels 0 and 1 and configures them for buffered pwm operation. the timer channel 0 registers (tch0h:tch0l) initially control the buffered pwm output. timer status control register 0 (tscr0) controls and monitors the pwm signal from the linked channels. ms0b takes priority over ms0a. setting ms2b links channels 2 and 3 and configures them for buffered pwm operation. the timer channel 2 registers (tch2h:tch2l) initially control the pwm output. timer status control register 2 (tscr2) controls and monitors the pwm signal from the linked channels. ms2b takes priority over ms2a. clearing the toggle-on-overflow bit, tovx, inhibits output toggles on timer overflows. subsequent output compares try to force the output to a state it is already in and have no effect. the result is a 0 percent duty cycle output. setting the chxmax bit generates a 100 percent duty cycle output. (see 15.9.4 timer channel status and control registers .)
timer interface module (tim) interrupts mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 259 non-disclosure agreement required 15.5 interrupts these tim sources can generate interrupt requests: ? tim overflow flag (tof) tof is set when the tim counter value matches the value in the tim counter modulo registers. the tim overflow interrupt enable bit, toie, enables the tof flag to generate tim overflow cpu interrupt requests. tof and toie are in the tim status and control register. ? tim channel flags (ch3fCch0f) chxf is set when an input capture or output compare occurs on channel x. the channel x interrupt enable bit, chxie, enables the chxf flag to generate tim channel x cpu interrupt requests. chxf and chxie are in the tim channel x status and control register. 15.6 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 15.6.1 wait mode the tim remains active after the execution of a wait instruction. any enabled cpu interrupt request from the tim can bring the mcu out of wait mode. if the tim is not required to bring the mcu out of wait mode, reduce power consumption by stopping the tim before executing the wait instruction. 15.6.2 stop mode the tim is inactive after the execution of a stop instruction. the stop instruction does not affect register conditions or the state of the timer counter. timer operation resumes when the mcu exits stop mode after an external interrupt.
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 260 timer interface module (tim) motorola 15.7 tim during break interrupts a break interrupt stops the timer counter. the system integration module (sim) controls whether status bits in other modules can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. (see 19.5.2 break address registers .) to allow software to clear status bits during a break interrupt, write a logic 1 to the bcfe bit. if a status bit is cleared during the break state, it remains cleared when the mcu exits the break state. to protect status bits during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), software can read and write i/o registers during the break state without affecting status bits. some status bits have a 2-step read/write clearing procedure. if software does the first step on such a bit before the break, the bit cannot change during the break state as long as bcfe is at logic 0. after the break, doing the second step clears the status bit. 15.8 i/o signals port e shares five of its pins with the tim. ptg3/tclk is an external clock input to the timer prescaler. the four timer channel i/o pins are ptg4/tch0, ptg5/tch1, ptg6/tch2, and ptg7/tch3.
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 261 non-disclosure agreement required 15.8.1 tim clock pin (ptg3/tclk) ptg3/tclk is an external clock input that can be the clock source for the timer counter instead of the prescaled internal bus clock. select the ptg3/tclk input by writing logic 1s to the three prescaler select bits, ps[2:0]. (see 15.9.1 timer status and control register .) the minimum tclk pulse width, tclk lmin or tclk hmin , is: the maximum tclk frequency is: bus frequency ? 2 15.8.2 timer channel i/o pins (ptg4/tch0Cptg7/tch3) each channel i/o pin is programmable independently as an input capture pin or an output compare pin. ptg4/tch0 and ptg6/tch2 can be configured as buffered output compare or buffered pwm pins. 15.9 i/o registers these i/o registers control and monitor operation of the tim: ? timer status and control register (tsc) ? timer control registers (tcnth:tcntl) ? timer counter modulo registers (tmodh:tmodl) ? timer channel status and control registers (tsc0, tsc1, tsc2, and tsc3) ? timer channel registers (tch0h:tch0l, tch1h:tch1l, tch2h:tch2l, and tch3h:tch3l) 1 bus frequency ------------------------------------- t su +
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 262 timer interface module (tim) motorola 15.9.1 timer status and control register the timer status and control register (tsc): ? enables timer overflow interrupts ? flags timer overflows ? stops the timer counter ? resets the timer counter and prescaler ? prescales the timer counter clock tof timer overflow flag bit this read/write flag is set when the timer counter reaches the modulo value programmed in the timer counter modulo registers. clear tof by reading the timer status and control register when tof is set and then writing a logic 0 to tof. if another timer overflow occurs before the clearing sequence is complete, then writing logic 0 to tof has no effect. therefore, a tof interrupt request cannot be lost due to inadvertent clearing of tof. reset clears the tof bit. writing a logic 1 to tof has no effect. 1 = timer counter has reached modulo value. 0 = timer counter has not reached modulo value. toie timer overflow interrupt enable bit this read/write bit enables timer overflow interrupts when the tof bit becomes set. reset clears the toie bit. 1 = timer overflow interrupts enabled 0 = timer overflow interrupts disabled address: $0020 bit 7 654321 bit 0 read: tof toie tstop 00 ps2 ps1 ps0 write: 0 trst reset: 00100000 = unimplemented figure 15-4. timer status and control register (tsc)
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 263 non-disclosure agreement required tstop timer stop bit this read/write bit stops the timer counter. counting resumes when tstop is cleared. reset sets the tstop bit, stopping the timer counter until software clears the tstop bit. 1 = timer counter stopped 0 = timer counter active note: do not set the tstop bit before entering wait mode if the tim is required to exit wait mode. trst timer reset bit setting this write-only bit resets the timer counter and the timer prescaler. setting trst has no effect on any other registers. counting resumes from $0000. trst is cleared automatically after the timer counter is reset and always reads as logic 0. reset clears the trst bit. 1 = prescaler and timer counter cleared 0 = no effect note: setting the tstop and trst bits simultaneously stops the timer counter at a value of $0000. ps2Cps0 prescaler select bits these read/write bits select either the ptg3/tclk pin or one of the seven prescaler outputs as the input to the timer counter as table 15-1 shows. reset clears the ps2Cps0 bits. note: tclk is a floating input pin. do not select ps2Cps0 = 111. table 15-1. prescaler selection ps2Cps0 tim clock source 000 internal bus clock 001 internal bus clock ? 2 010 internal bus clock ? 4 011 internal bus clock ? 8 100 internal bus clock ? 16 101 internal bus clock ? 32 110 internal bus clock ? 64 111 ptg3/tclk
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 264 timer interface module (tim) motorola 15.9.2 timer counter registers the two read-only timer counter registers (tcnth and tcntl) contain the high and low bytes of the value in the timer counter. reading the high byte (tcnth) latches the contents of the low byte (tcntl). subsequent reads of tcnth do not affect the latched tcntl value until tcntl is read. reset clears the timer counter registers. setting the timer reset bit (trst) also clears the timer counter registers. address: $0022 bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 0 write: reset: 00000000 = unimplemented figure 15-5. timer counter register high (tcnth) address: $0023 bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 00000000 = unimplemented figure 15-6. timer counter register low (tcntl)
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 265 non-disclosure agreement required 15.9.3 timer modulo registers the read/write timer modulo registers (tmodh and tmodl) contain the modulo value for the timer counter. when the timer counter reaches the modulo value, the overflow flag (tof) becomes set, and the timer counter resumes counting from $0000 at the next clock. the tof bit and overflow interrupts are inhibited after a write to the high byte (tmodh) until the low byte (tmodl) is written. reset sets the timer modulo registers. note: reset the timer counter before writing to the timer modulo registers. address: $0024 bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 11111111 figure 15-7. timer modulo register high (tmodh) address: $0025 bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 11111111 figure 15-8. timer modulo register low (tmodl)
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 266 timer interface module (tim) motorola 15.9.4 timer channel status and control registers each of the timer channel status and control registers (tsc0Ctsc3): ? flags input captures and output compares ? enables input capture and output compare interrupts ? selects input capture, output compare, or pwm operation ? selects high, low, or toggling output on output compare ? selects rising edge, falling edge, or any edge as the active input capture trigger ? selects output toggling on timer overflow ? selects 100 percent pwm duty cycle address: $0026 bit 7 654321 bit 0 read: ch0f ch0ie ms0b ms0a els0b els0a tov0 ch0max write: 0 reset: 00000000 figure 15-9. timer channel 0 status and control register (tsc0) address: $0029 bit 7 654321 bit 0 read: ch1f ch1ie 0 ms1a els1b els1a tov1 ch1max write: 0 reset: 00000000 = unimplemented figure 15-10. timer channel 1 status and control register (tsc1)
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 267 non-disclosure agreement required chxf channel x flag bit when channel x is an input capture channel, this read/write bit is set when an active edge occurs on the channel x pin. when channel x is an output compare channel, chxf is set when the value in the timer counter registers matches the value in the timer channel x registers. when tim cpu interrupt requests are enabled (chxie:dmaxs = 1:0), clear chxf by reading timer channel x status and control register with chxf set and then writing a logic 0 to chxf. if another interrupt request occurs before the clearing sequence is complete, then writing logic 0 to chxf has no effect. therefore, an interrupt request cannot be lost due to inadvertent clearing of chxf. when tim dma service requests are enabled (chxie:dmaxs = 1:1), clear chxf by reading or writing to the low byte of the timer channel x registers (tchxl). reset clears the chxf bit. writing a logic 1 to chxf has no effect. 1 = input capture or output compare on channel x 0 = no input capture or output compare on channel x address: $002c bit 7 654321 bit 0 read: ch2f ch2ie ms2b ms2a els2b els2a tov2 ch2max write: 0 reset: 00000000 figure 15-11. timer channel 2 status and control register (tsc2) address: $002f bit 7 654321 bit 0 read: ch3f ch3ie 0 ms3a els3b els3a tov3 ch3max write: 0 reset: 00000000 = unimplemented figure 15-12. timer channel 3 status and control register (tsc3)
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 268 timer interface module (tim) motorola chxie channel x interrupt enable bit this read/write bit enables tim cpu interrupts service requests on channel x. the dmaxs bit in the timer dma select register selects channel x tim dma service requests or tim cpu interrupt requests. note: tim dma service requests cannot be used in buffered pwm mode. in buffered pwm mode, disable tim dma service requests by clearing the dmaxs bit in the timer dma select register. reset clears the chxe bit. 1 = channel x cpu interrupt requests and dma service requests enabled 0 = channel x cpu interrupt requests and dma service requests disabled note: reading the high byte of the timer channel x registers (tchxh) inhibits the chxf flag until the low byte (tchxl) is read. msxb mode select bit b this read/write bit selects buffered output compare/pwm operation. msxb exists only in the timer channel 0 and timer channel 2 status and control registers. setting ms0b disables the channel 1 status and control register. setting ms2b disables the channel 3 status and control register. reset clears the msxb bit. 1 = buffered output compare/pwm operation enabled 0 = buffered output compare/pwm operation disabled msxa mode select bit a when elsxb:a 1 00, this read/write bit selects either input capture operation or unbuffered output compare/pwm operation. (see table 15-2 .) 1 = unbuffered output compare/pwm operation 0 = input capture operation when elsxb:a = 00, this read/write bit selects the initial output level of the tchx pin. (see table 15-2 .) reset clears the msxa bit. 1 = initial output level low 0 = initial output level high
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 269 non-disclosure agreement required note: before changing a channel function by writing to the msxb or msxa bit, set the tstop and trst bits in the timer status and control register (tsc). elsxb and elsxa edge/level select bits when channel x is an input capture channel, these read/write bits control the active edge-sensing logic on channel x. when channel x is an output compare channel, elsxb and elsxa control the channel x output behavior when an output compare occurs. when elsxb and elsxa are both clear, channel x is not connected to port e, and pin ptgx/tchx is available as a general-purpose i/o pin. table 15-2 shows how elsxb and elsxa work. reset clears the elsxb and elsxa bits. table 15-2. mode, edge, and level selection msxb and msxa elsxb and elsxa mode configuration x0 00 output preset set initial output level high x1 00 set initial output level low xx 00 tchx pin under port control 00 01 input capture capture on rising edge only 00 10 capture on falling edge only 00 11 capture on rising or falling edge xx 00 tchx pin under port control; initial output low 01 01 output compare or pwm toggle output on compare 01 10 clear output on compare 01 11 set output on compare xx 00 tchx pin under port control (1) 1x 01 buffered output compare or buffered pwm toggle output on compare 1x 10 clear output on compare 1x 11 set output on compare note: 1. initial output high if msxa = 0. initial output low if msxa = 1.
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 270 timer interface module (tim) motorola note: before enabling a timer channel register for input capture operation, make sure that the ptg/tchx pin is stable for at least two bus clocks. tovx toggle on overflow bit when channel x is an output compare channel, this read/write bit controls the behavior of the channel x output when the timer counter overflows. when channel x is an input capture channel, tovx has no effect. reset clears the tovx bit. 1 = channel x pin toggles on timer counter overflow. 0 = channel x pin does not toggle on timer counter overflow. note: when tovx is set, a timer counter overflow takes precedence over a channel x output compare if both occur at the same time. note: reading the high byte of the timer channel x registers prevents the channel x pin from toggling until the low byte is read. chxmax channel x maximum (100 percent) pwm duty cycle bit this read/write bit forces the duty cycle of buffered and unbuffered pwm signals to 100 percent. as figure 15-13 shows, the chxmax bit takes effect in the cycle after it is set or cleared. the output stays at the 100 percent duty cycle level until the cycle after chxmax is cleared. figure 15-13. chxmax latency output overflow ptgx/tchx period chxmax overflow overflow overflow overflow compare output compare output compare output compare
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 271 non-disclosure agreement required 15.9.5 timer channel registers the timer channel registers (tch0h/lCtch3h/l) are read/write registers containing the captured timer counter value of the input capture function or the output compare value of the output compare function. the state of the timer channel registers after reset is unknown. in input capture mode (msxb:msxa = 0:0), reading the high byte of the timer channel x registers (tchxh) inhibits input captures until the low byte (tchxl) is read. in output compare mode (msxb:msxa 1 0:0), writing to the high byte of the timer channel x registers (tchxh) inhibits output compares until the low byte (tchxl) is written. address: $0027 bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset figure 15-14. timer channel 0 register high (tch0h) address: $0028 bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 15-15. timer channel 0 register low (tch0l)
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 272 timer interface module (tim) motorola address: $002a bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset figure 15-16. timer channel 1 register high (tch1h) address: $002b bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 15-17. timer channel 1 register low (tch1l) address: $002d bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset figure 15-18. timer channel 2 register high (tch2h) address: $002e bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 15-19. timer channel 2 register low (tch2l)
timer interface module (tim) i/o registers mc68hc(9)08pt48 rev. 2.0 advance information motorola timer interface module (tim) 273 non-disclosure agreement required address: $0030 bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: indeterminate after reset figure 15-20. timer channel 3 register high (tch3h) address: $0031 bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: indeterminate after reset figure 15-21. timer channel 3 register low (tch3l)
non-disclosure agreement required timer interface module (tim) advance information mc68hc(9)08pt48 rev. 2.0 274 timer interface module (tim) motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola timebase module (timtbx) 275 non-disclosure agreement required advance information mc68hc(9)08pt48 section 16. timebase module (timtbx) 16.1 contents 16.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 16.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 16.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 16.5 timebase control register description . . . . . . . . . . . . . . . . .277 16.6 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7 low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7.1 wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.7.2 stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 16.2 introduction the timebase module (timtbx) consists of a counter/divider clocked by the crystal clock which will generate periodic interrupts at user selectable rates. 16.3 features timebase features include: ? software programmable 1-hz, 2-hz, 4-hz, and 8-hz periodic interrupt ? uses 32.0-khz, 32.748-khz or 38.4-khz crystal
non-disclosure agreement required timebase module (timtbx) advance information mc68hc(9)08pt48 rev. 2.0 276 timebase module (timtbx) motorola 16.4 functional description note: this module is designed to support 32-khz, 32.768-khz, and 38.4-khz oscillators. input crystal frequency is selected by the first write of the xtalr1:xtalr0 bits of the control register tbxcr, immediately after reset. this module can generate a periodic interrupt by dividing the crystal frequency, cgmxclk. the counter is initialized to 0 when tbxon bit is cleared. the counter, shown in figure 16-1 , starts counting when the tbxon bit is set. when the counter overflows at the tap selected by tbxr1:tbxr0, the tbxif bit gets set. if the tbxie bit is set, an interrupt request is sent to the cpu. the tbxif flag is cleared by writing a 1 to the tack bit. the first time the tbxif flag is set after enabling the timebase module, the interrupt is generated at approximately half of the overflow period. subsequent events occur at the exact period. figure 16-1. timebase block diagram ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 ? 2 dq ck clr 00 01 10 11 tbxint mux sel cgmxclk tack tbxr0 tbxr1 tbxif tbxie tbxon ? 32 ? 32n ? 64n ? 256n v dd 8-bit counter ? 125 ? 128 ? 150 xtalr0 xtalr1 01 10 else ? 128n ? n ? 32 prescalar post-count div
timebase module (timtbx) timebase control register description mc68hc(9)08pt48 rev. 2.0 advance information motorola timebase module (timtbx) 277 non-disclosure agreement required 16.5 timebase control register description the timebase control register (tbxcr) is used to enable the timebase interrupts and set the rate. tbxif timebase interrupt flag the read-only flag bit is set when the timebase counter has rolled over. 1 = timebase interrupt pending 0 = timebase interrupt not pending tbxie timebase interrupt enabled the read/write bit enables the timebase interrupt when the tbif bit becomes set. reset clears the tbie bit 1 = timebase interrupt enabled 0 = timebase interrupt disabled tbxr1 and tbxr0 timebase rate selection these read/write bits are used to select the rate of timebase interrupts as shown in table 16-1 . address: $0038 bit 7 654321 bit 0 read: tbxif tbxie tbxr1 tbxr0 0 tbxon xtalr1 xtalr0 write: tack reset: 00000000 = unimplemented figure 16-2. timebase control register (tbxcr) table 16-1. timebase rate selection tbxr1 and tbxr0 divider timebase interrupt rate (hz) vs (ms) 00 1/256n 1 1000 01 1/128n 2 500 10 1/64n 4 250 11 1/32n 8 125
non-disclosure agreement required timebase module (timtbx) advance information mc68hc(9)08pt48 rev. 2.0 278 timebase module (timtbx) motorola note: do not change tbxr1:tbxr0 bits while the timebase is enabled (tbxon=1). divider ratio, n, is defined by the xtalr[1:0] selection. tack timebase acknowledge the write-only tack bit always reads 0. writing a logic 1 to this bit clears tbif, the timebase interrupt flag. writing a logic 0 to this bit has no effect. 1 = clear timebase interrupt flag 0 = no effect tbxon timebase enabled the read/write bit enables the timebase. timebase may be turned off to reduce power consumption when its function is not necessary. the counter can be initialized by clearing and then setting this bit. reset clears the tbxon bit. 1 = timebase enabled 0 = timebase disabled; counter initialized to 0 xtalr1 and xtalr0 input crystal frequency selection these bits are used to select the input crystal frequencies as shown in table 16-1 . they can be written once only following a reset. any subsequent writes to these bits after the first valid write will be ignored. default value upon reset is 00, so a crystal frequency of 38.4 khz is assumed. note: it is recommended that these bits be written into at the beginning of the reset sequence. to minimize the effect of timing discrepancies resulting from the choice of different input crystal frequencies. although these bits are defaulted to 0, the user should write to these bits to prevent subsequent writes from unintentionally changing the crystal frequency selection. table 16-2. input crystal frequency selection xtalr1 and xtalr0 crystal frequencies (khz) divider ratio, n 00 default 38.4 150 01 32.0 125 10 32.768 128 11 38.4 150
timebase module (timtbx) interrupt mc68hc(9)08pt48 rev. 2.0 advance information motorola timebase module (timtbx) 279 non-disclosure agreement required 16.6 interrupt the timebase module can interrupt the cpu on a regular basis with a rate defined by tbxr1 and tbxr0. when the timebase counter chain rolls over, the counter chain overflow will generate a cpu interrupt request. interrupt must be acknowledged by writing a logic 1 to tack bit. 16.7 low-power modes the wait and stop instructions put the mcu in low power- consumption standby modes. 16.7.1 wait mode the timebase module remains active after execution of the wait instruction. in wait mode, the timebase register is not accessible by the cpu. if the timebase functions are not required during wait mode, reduce the power consumption by stopping the timebase before enabling the wait instruction. 16.7.2 stop mode the timebase is inactive after execution of the stop instruction. the stop instruction does not affect register conditions or the state of the timebase counter. the timebase operation continues when the mcu exits stop mode with an external interrupt, after the system clock resumes.
non-disclosure agreement required timebase module (timtbx) advance information mc68hc(9)08pt48 rev. 2.0 280 timebase module (timtbx) motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 281 non-disclosure agreement required advance information mc68hc(9)08pt48 section 17. input/output (i/o) ports 17.1 contents 17.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282 17.3 port a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 17.3.1 port a data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 17.3.2 data direction register a . . . . . . . . . . . . . . . . . . . . . . . . .284 17.4 port b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 17.4.1 port b data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 17.4.2 data direction register b . . . . . . . . . . . . . . . . . . . . . . . . .286 17.5 port c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 17.5.1 port c data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 17.5.2 data direction register c . . . . . . . . . . . . . . . . . . . . . . . . .288 17.6 port d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 17.6.1 port d data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 17.6.2 data direction register d . . . . . . . . . . . . . . . . . . . . . . . . .290 17.7 port e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 17.7.1 port e data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 17.7.2 data direction register e . . . . . . . . . . . . . . . . . . . . . . . . .292 17.8 port f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 17.8.1 port f data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 17.8.2 data direction register f . . . . . . . . . . . . . . . . . . . . . . . . .294 17.9 port g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296 17.9.1 port g data register . . . . . . . . . . . . . . . . . . . . . . . . . . . .296 17.9.2 data direction register g . . . . . . . . . . . . . . . . . . . . . . . .296
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 282 input/output (i/o) ports motorola 17.2 introduction 56 bidirectional input-output (i/o) pins form seven parallel ports. all i/o pins are programmable as inputs or outputs. note: connect any unused i/o pins to an appropriate logic level, either v dd or v ss . although the i/o ports do not require termination for proper operation, termination reduces excess current consumption and the possibility of electrostatic damage. addr. register name bit 7 6 5 4 3 2 1 bit 0 $0000 port a data register (pta) read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset $0001 port b data register (ptb) read: ptb7 ptb6 ptb5 ptb4 ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset $0002 port c data register (ptc) read: ptc7 ptc6 ptc5 ptc4 ptc3 ptc2 ptc1 ptc0 write: reset: unaffected by reset $0003 port d data register (ptd) read: ptd7 ptd6 ptd5 ptd4 ptd3 ptd2 ptd1 ptd0 write: reset: unaffected by reset $0004 port a data direction register (ddra) read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset: 0 0 0 0 0 0 0 0 $0005 port b data direction register (ddrb) read: ddrb7 ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset: 0 0 0 0 0 0 0 0 figure 17-1. i/o port registers
input/output (i/o) ports introduction mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 283 non-disclosure agreement required $0006 port c data direction register (ddrc) read: ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 write: reset: 0 0 0 0 0 0 0 0 $0007 port d data direction register (ddrd) read: ddrd7 ddrd6 ddrd5 ddrd4 ddrd3 ddrd2 ddrd1 ddrd0 write: reset: 0 0 0 0 0 0 0 0 $0008 port e data register (pte) read: pte7 pte6 pte5 pte4 pte3 pte2 pte1 pte0 write: reset: unaffected by reset $0009 port f data register (ptf) read: ptf7 ptf6 ptf5 ptf4 ptf3 ptf2 ptf1 ptf0 write: reset: unaffected by reset $000a port g data register (ptg) read: ptg7 ptg6 ptg5 ptg4 ptg3 ptg2 ptg1 ptg0 write: reset: unaffected by reset $000c port e data direction register (ddre) read: ddre7 ddre6 ddre5 ddre4 ddre3 ddre2 ddre1 ddre0 write: reset: 0 0 0 0 0 0 0 0 $000d port f data direction register (ddrf) read: ddrf7 ddrf6 ddrf5 ddrf4 ddrf3 ddrf2 ddrf1 ddrf0 write: reset: 0 0 0 0 0 0 0 0 $000e port g data direction register (ddrg) read: ddrg7 ddrg6 ddrg5 ddrg4 ddrg3 ddrg2 ddrg1 ddrg0 write: reset: 0 0 0 0 0 0 0 0 addr. register name bit 7 6 5 4 3 2 1 bit 0 figure 17-1. i/o port registers
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 284 input/output (i/o) ports motorola 17.3 port a port a is an 8-bit, general-purpose, bidirectional i/o port. 17.3.1 port a data register the port a data register (pta) contains a data latch for each of the eight port a pins. pta[7:0] port a data bits these read/write bits are software programmable. data direction of each port a pin is under the control of the corresponding bit in data direction register a. reset has no effect on port a data. 17.3.2 data direction register a data direction register a (ddra) determines whether each port a pin is an input or an output. writing a logic 1 to a ddra bit enables the output buffer for the corresponding port a pin. a logic 0 disables the output buffer. address: $0000 bit 7 654321 bit 0 read: pta7 pta6 pta5 pta4 pta3 pta2 pta1 pta0 write: reset: unaffected by reset figure 17-2. port a data register (pta) address: $0004 bit 7 654321 bit 0 read: ddra7 ddra6 ddra5 ddra4 ddra3 ddra2 ddra1 ddra0 write: reset: 00000000 figure 17-3. data direction register a (ddra)
input/output (i/o) ports port a mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 285 non-disclosure agreement required ddra7Cddra0 data direction register a bits these read/write bits control port a data direction. reset clears ddra7Cddra0, configuring all port a pins as inputs. 1 = corresponding port a pin configured as output 0 = corresponding port a pin configured as input note: avoid glitches on port a pins by writing to the port a data register before changing data direction register a bits from 0 to 1. figure 17-4 shows the port a i/o logic. figure 17-4. port a i/o circuit when bit ddrax is a logic 1, reading address $0000 reads the ptax data latch. when bit ddrax is a logic 0, reading address $0000 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-1 summarizes the operation of the port a pins. read ddra write ddra reset write pta read pta ptax ddrax ptax internal data bus table 17-1. port a pin functions ddra bit pta bit i/o pin mode accesses to ddra accesses to pta read/write read write 0x (1) input, hi-z (2) ddra7Cddra0 pin pta7Cpta0 (3) 1 x output ddra7Cddra0 pta7 C pta0 pta7Cpta0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 286 input/output (i/o) ports motorola 17.4 port b port b is an 8-bit, general-purpose, bidirectional i/o port. 17.4.1 port b data register the port b data register (ptb) contains a data latch for each of the eight port pins. ptb7Cptb0 port b data bits these read/write bits are software-programmable. data direction of each port b pin is under the control of the corresponding bit in data direction register b. reset has no effect on port b data. 17.4.2 data direction register b data direction register b (ddrb) determines whether each port b pin is an input or an output. writing a logic 1 to a ddrb bit enables the output buffer for the corresponding port b pin; a logic 0 disables the output buffer. address: $0001 bit 7 654321 bit 0 read: ptb7 ptb6 ptb5 ptb4 ptb3 ptb2 ptb1 ptb0 write: reset: unaffected by reset figure 17-5. port b data register (ptb) address: $0005 bit 7 654321 bit 0 read: ddrb7 ddrb6 ddrb5 ddrb4 ddrb3 ddrb2 ddrb1 ddrb0 write: reset: 00000000 figure 17-6. data direction register b (ddrb)
input/output (i/o) ports port b mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 287 non-disclosure agreement required ddrb7Cddrb0 data direction register b bits these read/write bits control port b data direction. reset clears ddrb[7:0], configuring all port b pins as inputs. 1 = corresponding port b pin configured as output 0 = corresponding port b pin configured as input note: avoid glitches on port b pins by writing to the port b data register before changing data direction register b bits from 0 to 1. figure 17-7 shows the port b i/o logic. figure 17-7. port b i/o circuit when bit ddrbx is a logic 1, reading address $0001 reads the ptbx data latch. when bit ddrbx is a logic 0, reading address $0001 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-2 summarizes the operation of the port b pins. read ddrb write ddrb reset write ptb read ptb ptbx ddrbx ptbx internal data bus table 17-2. port b pin functions ddrb bit ptb bit i/o pin mode accesses to ddrb accesses to ptb read/write read write 0x (1) input, hi-z (2) ddrb7Cddrb0 pin ptb7Cptb0 (3) 1 x output ddrb7Cddrb0 ptb7Cptb0 ptb7Cptb0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 288 input/output (i/o) ports motorola 17.5 port c port c is an 8-bit, general-purpose, bidirectional i/o port. 17.5.1 port c data register the port c data register (ptc) contains a data latch for each of the port c pins. ptc7Cptc0 port c data bits these read/write bits are software-programmable. data direction of each port c pin is under the control of the corresponding bit in data direction register c. 17.5.2 data direction register c data direction register c (ddrc) determines whether each port c pin is an input or an output. writing a logic 1 to a ddrc bit enables the output buffer for the corresponding port c pin. a logic 0 disables the output buffer. address: $0002 bit 7 654321 bit 0 read: ptc7 ptc6 ptc5 ptc4 ptc3 ptc2 ptc1 ptc0 write: reset: unaffected by reset figure 17-8. port c data register (ptc) address: $0006 bit 7 654321 bit 0 read: ddrc7 ddrc6 ddrc5 ddrc4 ddrc3 ddrc2 ddrc1 ddrc0 write: reset: 00000000 figure 17-9. data direction register c (ddrc)
input/output (i/o) ports port c mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 289 non-disclosure agreement required ddrc7Cddrc0 data direction register c bits these read/write bits control port c data direction. reset clears ddrc7Cddrc0, configuring all port c pins as inputs. 1 = corresponding port c pin configured as output 0 = corresponding port c pin configured as input note: avoid glitches on port c pins by writing to the port c data register before changing data direction register c bits from 0 to 1. figure 17-10 shows the port c i/o logic. figure 17-10. port c i/o circuit when bit ddrcx is a logic 1, reading address $0002 reads the ptcx data latch. when bit ddrcx is a logic 0, reading address $0002 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-3 summarizes the operation of the port c pins. read ddrc write ddrc reset write ptc read ptc ptcx ddrcx ptcx internal data bus table 17-3. port c pin functions ddrc bit ptc bit i/o pin mode accesses to ddrc accesses to ptc read/write read write 0x (1) input, hi-z (2) ddrc7Cddrc0 pin ptc7Cptc0 (3) 1 x output ddrc7Cddrc0 ptc7Cptc0 ptc7Cptc0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 290 input/output (i/o) ports motorola 17.6 port d port d is an 8-bit, general-purpose, bidirectional i/o port. 17.6.1 port d data register the port d data register (ptd) contains a data latch for each of the eight port d pins. ptd[7:0] port d data bits these read/write bits are software programmable. data direction of each port d pin is under the control of the corresponding bit in data direction register d. reset has no effect on port d data. 17.6.2 data direction register d data direction register d (ddrd) determines whether each port d pin is an input or an output. writing a logic 1 to a ddrd bit enables the output buffer for the corresponding port d pin. a logic 0 disables the output buffer. address: $0003 bit 7 654321 bit 0 read: ptd7 ptd6 ptd5 ptd4 ptd3 ptd2 ptd1 ptd0 write: reset: unaffected by reset figure 17-11. port d data register (ptd) address: $0007 bit 7 654321 bit 0 read: ddrd7 ddrd6 ddrd5 ddrd4 ddrd4 ddrd3 ddrd1 ddrd0 write: reset: 00000000 figure 17-12. data direction register d (ddrd)
input/output (i/o) ports port d mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 291 non-disclosure agreement required ddrd7Cddrd0 data direction register d bits these read/write bits control port d data direction. reset clears ddrd[7:0], configuring all port d pins as inputs. 1 = corresponding port d pin configured as output 0 = corresponding port d pin configured as input note: avoid glitches on port d pins by writing to the port d data register before changing data direction register d bits from 0 to 1. figure 17-13 shows the port d i/o logic. figure 17-13. port d i/o circuit when bit ddrdx is a logic 1, reading address $0003 reads the ptdx data latch. when bit ddrdx is a logic 0, reading address $0003 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-4 summarizes the operation of the port d pins. read ddrd write ddrd reset write ptd read ptd ptdx ddrdx ptdx internal data bus table 17-4. port d pin functions ddrd bit ptd bit i/o pin mode accesses to ddrd accesses to ptd read/write read write 0x (1) input, hi-z (2) ddrd7Cddrd0 pin ptd7Cptd0 (3) 1 x output ddrd7Cddrd0 ptd7Cptd0 ptd7Cptd0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 292 input/output (i/o) ports motorola 17.7 port e port e is an 8-bit special function port that shares four of its pins with the a/d and the other four pins with spi. 17.7.1 port e data register the port e data register (pte) contains a data latch for each of the eight port pins. pte7Cpte0 port e data bits these read/write bits are software-programmable. data direction of each port e pin is under the control of the corresponding bit in data direction register e. reset has no effect on port e data. 17.7.2 data direction register e data direction register e (ddre) determines whether each port e pin is an input or an output. writing a logic 1 to a ddre bit enables the output buffer for the corresponding port e pin; a logic 0 disables the output buffer. address: $0008 bit 7 654321 bit 0 read: pte7 pte6 pte5 pte4 pte3 pte2 pte1 pte0 write: reset: unaffected by reset figure 17-14. port e data register (pte) address: $000c bit 7 654321 bit 0 read: ddre7 ddre6 ddre5 ddre4 ddre3 ddre2 ddre1 ddre0 write: reset: 00000000 figure 17-15. data direction register e (ddre)
input/output (i/o) ports port e mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 293 non-disclosure agreement required ddre7Cddre0 data direction register e bits these read/write bits control port e data direction. reset clears ddre7Cddre0, configuring all port e pins as inputs. 1 = corresponding port e pin configured as output 0 = corresponding port e pin configured as input note: avoid glitches on port e pins by writing to the port e data register before changing data direction register e bits from 0 to 1. figure 17-16 shows the port e i/o logic. figure 17-16. port e i/o circuit when bit ddrex is a logic 1, reading address $0046 reads the ptex data latch. when bit ddrex is a logic 0, reading address $0046 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-5 summarizes the operation of the port e pins. read ddre write ddre reset write pte read pte ptex ddrex ptex internal data bus table 17-5. port e pin functions ddre bit pte bit i/o pin mode accesses to ddre accesses to pte read/write read write 0x (1) input, hi-z (2) ddre7Cddre0 pin pte7Cpte0 (3) 1 x output ddre7Cddre0 pte7Cpte0 pte7Cpte0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 294 input/output (i/o) ports motorola 17.8 port f port f is an 8-bit special function port that shares with the keyboard interrupts. 17.8.1 port f data register the port f data register (ptf) contains a data latch for each of the port f pins. ptf7Cptf0 port f data bits these read/write bits are software-programmable. data direction of each port f pin is under the control of the corresponding bit in data direction register f. 17.8.2 data direction register f data direction register f (ddrf) determines whether each port f pin is an input or an output. writing a logic 1 to a ddrf bit enables the output buffer for the corresponding port f pin. a logic 0 disables the output buffer. address: $0009 bit 7 654321 bit 0 read: ptf7 ptf6 ptf5 ptf4 ptf3 ptf2 ptf1 ptf0 write: reset: unaffected by reset figure 17-17. port f data register (ptf) address: $000d bit 7 654321 bit 0 read: ddrf7 ddrf6 ddrf5 ddrf4 ddrf3 ddrf2 ddrf1 ddrf0 write: reset: 00000000 figure 17-18. data direction register f (ddrf)
input/output (i/o) ports port f mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 295 non-disclosure agreement required ddrf7Cddrf0 data direction register f bits these read/write bits control port f data direction. reset clears ddrf7Cddrf0, configuring all port f pins as inputs. 1 = corresponding port f pin configured as output 0 = corresponding port f pin configured as input note: avoid glitches on port f pins by writing to the port f data register before changing data direction register f bits from 0 to 1. figure 17-19 shows the port f i/o logic. figure 17-19. port f i/o circuit when bit ddrfx is a logic 1, reading address $0047 reads the ptfx data latch. when bit ddrfx is a logic 0, reading address $0047 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-6 summarizes the operation of the port f pins. read ddrf write ddrf reset write ptf read ptf ptfx ddrfx ptfx internal data bus table 17-6. port f pin functions ddrf bit ptf bit i/o pin mode accesses to ddrf accesses to ptf read/write read write 0x (1) input, hi-z (2) ddrf7Cddrf0 pin ptf7Cptf0 (3) 1 x output ddrf7Cddrf0 ptf7Cptf0 ptf7Cptf0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 296 input/output (i/o) ports motorola 17.9 port g port g is am 8-bit special function port that shares five of its pins with the timer and two of its pins with sci. 17.9.1 port g data register the port g data register (ptg) contains a data latch for each of the port g pins. ptg7Cptg0 port g data bits these read/write bits are software-programmable. data direction of each port g pin is under the control of the corresponding bit in data direction register g. 17.9.2 data direction register g data direction register g (ddrg) determines whether each port g pin is an input or an output. writing a logic 1 to a ddrg bit enables the output buffer for the corresponding port g pin. a logic 0 disables the output buffer. address: $000a bit 7 654321 bit 0 read: ptg7 ptg6 ptg5 ptg4 ptg3 ptg2 ptg1 ptg0 write: reset: unaffected by reset figure 17-20. port g data register (ptg) address: $000e bit 7 654321 bit 0 read: ddrg7 ddrg6 ddrg5 ddrg4 ddrg3 ddrg2 ddrg1 ddrg0 write: reset: 00000000 figure 17-21. data direction register g (ddrg)
input/output (i/o) ports port g mc68hc(9)08pt48 rev. 2.0 advance information motorola input/output (i/o) ports 297 non-disclosure agreement required ddrg7Cddrg0 data direction register g bits these read/write bits control port g data direction. reset clears ddrg7Cddrg0, configuring all port g pins as inputs. 1 = corresponding port g pin configured as output 0 = corresponding port g pin configured as input note: avoid glitches on port g pins by writing to the port g data register before changing data direction register g bits from 0 to 1. figure 17-22 shows the port g i/o logic. figure 17-22. port g i/o circuit when bit ddrgx is a logic 1, reading address $0048 reads the ptgx data latch. when bit ddrgx is a logic 0, reading address $0048 reads the voltage level on the pin. the data latch can always be written, regardless of the state of its data direction bit. table 17-7 summarizes the operation of the port g pins. read ddrg write ddrg reset write ptg read ptg ptgx ddrgx ptgx internal data bus table 17-7. port g pin functions ddrg bit ptg bit i/o pin mode accesses to ddrg accesses to ptg read/write read write 0x (1) input, hi-z (2) ddrg7Cddrg0 pin ptg7Cptg0 (3) 1 x output ddrg7Cddrg0 ptg7Cptg0 ptg7Cptg0 notes: 1. x = dont care 2. hi-z = high impedance 3. writing affects data register, but does not affect input.
non-disclosure agreement required input/output (i/o) ports advance information mc68hc(9)08pt48 rev. 2.0 298 input/output (i/o) ports motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola monitor rom (mon) 299 non-disclosure agreement required advance information mc68hc(9)08pt48 section 18. monitor rom (mon) 18.1 contents 18.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 18.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 18.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300 18.4.1 entering monitor mode . . . . . . . . . . . . . . . . . . . . . . . . . . .300 18.4.2 data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18.4.3 echoing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 18.4.4 break signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 18.4.5 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 18.4.6 baud rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 18.2 introduction this section describes the monitor rom. the monitor rom allows complete testing of the mcu through a single-wire interface with a host computer. 18.3 features features of the monitor rom include: ? normal user-mode pin functionality ? one pin dedicated to serial communication between monitor rom and host computer ? standard mark/space non-return-to-zero (nrz) communication with host computer ? 4800 baudC28.8 kbaud communication with host computer ? execution of code in ram or rom
non-disclosure agreement required monitor rom (mon) advance information mc68hc(9)08pt48 rev. 2.0 300 monitor rom (mon) motorola 18.4 functional description the monitor rom receives and executes commands from a host computer. figure 18-1 shows a sample circuit used to enter monitor mode and communicate with a host computer via a standard rs-232 interface. simple monitor commands can access any memory address. in monitor mode, the mcu can execute host-computer code in ram while all mcu pins retain normal operating mode functions. all communication between the host computer and the mcu is through the pta0 pin. a level-shifting and multiplexing interface is required between pta0 and the host computer. pta0 is used in a wired-or configuration and requires a pullup resistor. 18.4.1 entering monitor mode table 18-1 shows the pin conditions for entering monitor mode. enter monitor mode by either ? executing a software interrupt instruction (swi) or ? applying a logic 0 and then a logic 1 to the rst pin the mcu sends a break signal (10 consecutive logic 0s) to the host computer, indicating that it is ready to receive a command. the break signal also provides a timing reference to allow the host to determine the necessary baud rate. table 18-1. mode selection irq1 pin ptc0 pin ptc1 pin pta0 pin ptc3 pin mode cgmout bus frequency v dd + v hi 1011 monitor or v dd + v hi 1010 monitor cgmxclk cgmxclk 2 ----------------------------- cgmvclk 2 ----------------------------- cgmout 2 -------------------------- cgmout 2 --------------------------
monitor rom (mon) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola monitor rom (mon) 301 non-disclosure agreement required figure 18-1monitor mode circuit + + + v dd v dd a v dd + v hi mc145407 mc74hc125 68hc(9)08 rst irq1 v dda cgmxfc osc1 osc2 v ss v dd pta0 v dd 10 k w 0.1 m f 0.1 m f 10 w 6 5 2 4 3 1 db-25 2 3 7 20 18 17 19 16 15 v dd v dd v dd 10 m f 10 m f 10 m f 10 m f 1 2 4 7 14 3 0.1 m f 4.9152 mhz (ttl osc input) 10 k w ptc3 v dd 10 k w b a note: position a bus clock = cgmxclk ? 4 or cgmvclk ? 4 (see note.) 5 6 + ptc0 ptc1 v dd pta7 position b bus clock = cgmxclk ? 2
non-disclosure agreement required monitor rom (mon) advance information mc68hc(9)08pt48 rev. 2.0 302 monitor rom (mon) motorola monitor mode uses alternate vectors for reset, swi, and break interrupt. the alternate vectors are in the $fe page instead of the $ff page and allow code execution from the internal monitor firmware instead of user code. the cop module is disabled in monitor mode as long as v dd +v hi is applied to either the irq1 pin or the rst pin. burn-in can be accomplished by uploading code to ram in monitor mode, then pulling pta0 low and executing a reset. this causes a jump to ram.(see section 7. system integration module (sim) for more information on modes of operation.) note: holding the ptc3 pin low when entering monitor mode causes a bypass of a divide-by-two stage at the oscillator. the cgmout frequency is equal to the cgmxclk frequency, and the osc1 input directly generates internal bus clocks. in this case, the osc1 signal must have a 50 percent duty cycle at maximum bus frequency. table 18-2 is a summary of the differences between user mode and monitor mode. table 18-2. mode differences modes functions cop reset vector high reset vector low break vector high break vector low swi vector high swi vector low user enabled $fffe $ffff $fffc $fffd $fffc $fffd monitor disabled (1) 1. if the high voltage (v dd +v hi ) is removed from the irq1 pin or the rst pin, the sim as- serts its cop enable output. the cop is a mask option enabled or disabled by the copd bit in the mask option register. $fefe $feff $fefc $fefd $fefc $fefd note:
monitor rom (mon) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola monitor rom (mon) 303 non-disclosure agreement required 18.4.2 data format communication with the monitor rom is in standard non-return-to-zero (nrz) mark/space data format. (see figure 18-2 and figure 18-3 .) the data transmit and receive rate can be anywhere from 4800 baud to 28.8 kbaud. transmit and receive baud rates must be identical. figure 18-2. monitor data format figure 18-3. sample monitor waveforms 18.4.3 echoing as shown in figure 18-4 , the monitor rom immediately echoes each received byte back to the pta0 pin for error checking. any result of a command appears after the echo of the last byte of the command. figure 18-4. read transaction bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 bit 5 start bit bit 0 bit 1 next stop bit start bit bit 2 bit 3 bit 4 bit 6 bit 7 start bit bit 0 bit 1 next stop bit start bit bit 2 $a5 break bit 3 bit 4 bit 5 bit 6 bit 7 addr. high read read addr. high addr. low addr. low data echo sent to monitor result
non-disclosure agreement required monitor rom (mon) advance information mc68hc(9)08pt48 rev. 2.0 304 monitor rom (mon) motorola 18.4.4 break signal a start bit followed by nine low bits is a break signal. (see figure 18-5 .) when the monitor receives a break signal, it drives the pta0 pin high for the duration of two bits before echoing the break signal. figure 18-5. break transaction 18.4.5 commands the monitor rom uses these commands: ? read; read memory ? write; write memory ? iread; indexed read ? iwrite; indexed write ? readsp; read stack pointer ? run; run user program a sequence of iread or iwrite commands can access a block of memory sequentially over the full 64-kbyte memory map. 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 missing stop bit 2-stop-bit delay before zero echo
monitor rom (mon) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola monitor rom (mon) 305 non-disclosure agreement required table 18-3. read (read memory) command description read byte from memory operand speci?es 2-byte address in high byte:low byte order data returned returns contents of speci?ed address opcode $4a command sequence addr. high read read addr. high addr. low addr. low data echo sent to monitor result table 18-4. write (write memory) command description write byte to memory operand speci?es 2-byte address in high byte:low byte order; low byte followed by data byte data returned none opcode $49 command sequence addr. high write write addr. high addr. low addr. low data echo sent to monitor data
non-disclosure agreement required monitor rom (mon) advance information mc68hc(9)08pt48 rev. 2.0 306 monitor rom (mon) motorola table 18-5. read (indexed read) command description read next 2 bytes in memory from last address accessed operand speci?es 2-byte address in high byte:low byte order data returned returns contents of next two addresses opcode $1a command sequence data iread iread data echo sent to monitor result table 18-6. iwrite (indexed write) command description write to last address accessed + 1 operand speci?es single data byte data returned none opcode $19 command sequence data iwrite iwrite data echo sent to monitor
monitor rom (mon) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola monitor rom (mon) 307 non-disclosure agreement required table 18-7. readsp (read stack pointer) command description reads stack pointer operand none data returned returns stack pointer in high byte:low byte order opcode $0c command sequence sp high readsp readsp sp low echo sent to monitor result table 18-8. run (run user program) command description executes rti instruction operand none data returned none opcode $28 command sequence run run echo sent to monitor
non-disclosure agreement required monitor rom (mon) advance information mc68hc(9)08pt48 rev. 2.0 308 monitor rom (mon) motorola 18.4.6 baud rate with a 4.9152-mhz crystal and the ptc3 pin at logic 1 during reset, data is transferred between the monitor and host at 4800 baud. if the ptc3 pin is at logic 0 during reset, the monitor baud rate is 9600. when the cgm output, cgmout, is driven by the pll, the baud rate is determined by the mul7Cmul4 bits in the pll programming register (ppg). (see section 4. clock generator module (cgmb) .) table 18-9. monitor baud rate selection vco frequency multiplier (n) 123456 monitor baud rate 4800 9600 14,400 19,200 24,000 28,800
mc68hc(9)08pt48 rev. 2.0 advance information motorola break module 309 non-disclosure agreement required advance information mc68hc(9)08pt48 section 19. break module 19.1 contents 19.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309 19.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310 19.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310 19.4.1 flag protection during break interrupts . . . . . . . . . . . . . .312 19.4.2 cpu during break interrupts. . . . . . . . . . . . . . . . . . . . . . .312 19.4.3 tim during break interrupts . . . . . . . . . . . . . . . . . . . . . . .312 19.4.4 cop during break interrupts . . . . . . . . . . . . . . . . . . . . . .312 19.4.5 cop during break. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 19.5 break module registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 19.5.1 break status and control register . . . . . . . . . . . . . . . . . .313 19.5.2 break address registers. . . . . . . . . . . . . . . . . . . . . . . . . .314 19.6 wait mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314 19.2 introduction this section describes the break module. the break module can generate a break interrupt that stops normal program flow at a defined address to enter a background program.
non-disclosure agreement required break module advance information mc68hc(9)08pt48 rev. 2.0 310 break module motorola 19.3 features features of the break module include: ? accessible i/o (input/output) registers during the break interrupt ? cpu-generated break interrupts ? software-generated break interrupts ? computer operating properly (cop) disabling during break interrupts 19.4 functional description when the internal address bus matches the value written in the break address registers, the break module issues a breakpoint signal ( bkpt) to the sim. the sim then causes the cpu to load the instruction register with a software interrupt instruction (swi) after completion of the current cpu instruction. the program counter vectors to $fffc and $fffd ($fefc and $fefd in monitor mode). these events can cause a break interrupt to occur: ? a cpu-generated address (the address in the program counter) matches the contents of the break address registers. ? software writes a logic 1 to the brka bit in the break status and control register. ? software writes a logic 1 to the break active bit (brka) in the break status and control register. when a cpu-generated address matches the contents of the break address registers, the break interrupt begins after the cpu completes its current instruction. a return-from-interrupt instruction (rti) in the break routine ends the break interrupt and returns the mcu to normal operation. figure 19-1 shows the structure of the break module.
break module functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola break module 311 non-disclosure agreement required figure 19-1. break module block diagram iab[15:8] iab[7:0] 8-bit comparator 8-bit comparator control break address register low break address register high iab[15:0] bkpt (to sim) addr. register name bit 7 6 5 4 3 2 1 bit 0 $fe0d break address register high (brkh) read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 0 0 0 0 0 0 0 0 $fe0e break address register low (brkl) read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 0 0 0 0 0 0 0 0 $fe0f break status/control register (brkscr) read: brke brka write: reset: 0 0 0 0 0 0 0 0 = unimplemented figure 19-2. break i/o register summary
non-disclosure agreement required break module advance information mc68hc(9)08pt48 rev. 2.0 312 break module motorola 19.4.1 flag protection during break interrupts the system integration module (sim) controls whether or not module status bits can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear status bits during the break state. (see 7.8.3 sim break flag control register and see the break interrupts subsection for each module.) 19.4.2 cpu during break interrupts the cpu starts a break interrupt by: ? loading the instruction register with the swi instruction ? loading the program counter with $fffc:$fffd ($fefc:$fefd in monitor mode) the break interrupt begins after completion of the cpu instruction in progress. if the break address register match occurs on the last cycle of a cpu instruction, the break interrupt begins immediately. 19.4.3 tim during break interrupts a break interrupt stops the timer counter. 19.4.4 cop during break interrupts the cop is disabled during a break interrupt when v dd +v hi is present on the rst pin. 19.4.5 cop during break if the rst pin is at 2 v dd during a break, the cop counter stops. if the rst pin falls to logic 1 during break, the cop resumes operation.
break module break module registers mc68hc(9)08pt48 rev. 2.0 advance information motorola break module 313 non-disclosure agreement required 19.5 break module registers three registers control and monitor operation of the break module: ? break status and control register (brkscr) ? break address register high (brkh) ? break address register low (brkl) 19.5.1 break status and control register the break status and control register (brkscr) contains break module enable and status bits. brke break enable bit this bit enables breaks on break address register matches. clear brke by writing a logic 0 to bit 7. 1 = breaks enabled on 16-bit address match 0 = breaks disabled on 16-bit address match brka break active bit this status and control bit is set when a break address match occurs. writing a logic 1 to brka generates a break interrupt. clear brka by writing a logic 0 to it before exiting the break routine. 1 = break address match 0 = no break address match address: $fe0f bit 7 654321 bit 0 read: brke brka write: reset: 00000000 = unimplemented figure 19-3. break status and control register (brkscr)
non-disclosure agreement required break module advance information mc68hc(9)08pt48 rev. 2.0 314 break module motorola 19.5.2 break address registers the break address registers (brkh and brkl) contain the high and low bytes of the desired breakpoint address. reset clears the break address registers. 19.6 wait mode if enabled, the break module is active in wait mode. in the break routine, the user can subtract one from the return address on the stack if sbsw is set. (see 7.8.1 sim break status register ) clear the sbsw bit by writing logic 0 to it. address: $fe0d bit 7 654321 bit 0 read: bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 write: reset: 00000000 figure 19-4. break address register high (brkh) address: $fe0e bit 7 654321 bit 0 read: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 write: reset: 00000000 figure 19-5. break address register low (brkl)
mc68hc(9)08pt48 rev. 2.0 advance information motorola external interrupt module (irq) 315 non-disclosure agreement required advance information mc68hc(9)08pt48 section 20. external interrupt module (irq) 20.1 contents 20.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 20.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .315 20.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316 20.4.1 irq1 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319 20.4.2 irq2 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .320 20.5 irq module during break interrupts . . . . . . . . . . . . . . . . . . .321 20.6 irq status and control register . . . . . . . . . . . . . . . . . . . . . .321 20.2 introduction this section describes the external interrupt module which supports external interrupt functions. 20.3 features features of the irq module include: ? two dedicated external interrupt pins ( irq1 and irq2) ? separate irq1 and irq2 interrupt masks ? hysteresis buffers
non-disclosure agreement required external interrupt module (irq) advance information mc68hc(9)08pt48 rev. 2.0 316 external interrupt module (irq) motorola 20.4 functional description a logic 0 applied to any of the external interrupt pins can latch a cpu interrupt request. figure 20-1 shows the structure of the irq module. interrupt signals on the irq1 pin are latched into the irq1 latch. interrupt signals on the irq2 pin are latched into the irq2 interrupt latch. an interrupt latch remains set until one of these actions occurs: ? vector fetch a vector fetch automatically generates an interrupt acknowledge signal that clears the latch that caused the vector fetch. ? software clear software can clear an interrupt latch by writing to the appropriate acknowledge bit in the interrupt status and control register (iscr). writing a logic 1 to the ack1 bit clears the irq1 latch. writing a logic 1 to the ack2 bit clears the irq2 interrupt latch. ? reset a reset automatically clears both interrupt latches. all of the external interrupt pins are falling-edge-triggered and are software configurable to be both falling-edge and low-level-triggered. the mode1 bit in the iscr controls the triggering sensitivity of the irq1 pin. the mode2 bit controls the triggering sensitivity of the irq2 interrupt pin. when an interrupt pin is edge-triggered only, the interrupt latch remains set until a vector fetch, software clear, or reset occurs. when an interrupt pin is both falling-edge and low-level-triggered, the interrupt latch remains set until both of these occur: ? vector fetch, software clear, or reset ? return of the interrupt pin to logic 1
external interrupt module (irq) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola external interrupt module (irq) 317 non-disclosure agreement required figure 20-1. irq module block diagram the vector fetch or software clear may occur before or after the interrupt pin returns to logic 1. as long as the pin is low, the interrupt request remains pending. when set, the imask1 and imask2 bits in the iscr mask all external interrupt requests. a latched interrupt request is not presented to the interrupt priority logic unless the corresponding imask bit is clear. note: the interrupt mask (i) in the condition code register (ccr) masks all interrupt requests, including external interrupt requests. (see figure 20-2 .) ack1 imask1 dq ck clr irq1 irq2 interrupt irq1 latch request interrupt irq1 irq2 v dd mode1 ack2 dq ck clr v dd mode2 synchro- nizer synchro- nizer imask2 irq2 interrupt latch request
non-disclosure agreement required external interrupt module (irq) advance information mc68hc(9)08pt48 rev. 2.0 318 external interrupt module (irq) motorola figure 20-2. irq interrupt flowchart from reset i bit set? fetch next yes no interrupt? instruction swi instruction? rti instruction? no stack cpu registers no set i bit load pc with interrupt vector no yes unstack cpu registers execute instruction yes yes
external interrupt module (irq) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola external interrupt module (irq) 319 non-disclosure agreement required 20.4.1 irq1 pin a logic 0 on the irq1 pin can latch an interrupt request into the irq1 latch. a vector fetch, software clear, or reset clears the irq1 latch. if the mode1 bit is set, the irq1 pin is both falling-edge-sensitive and low-level-sensitive. with mode1 set, both of these actions must occur to clear the irq1 latch: ? vector fetch, software clear, or reset a vector fetch generates an interrupt acknowledge signal to clear the latch. software may generate the interrupt acknowledge signal by writing a logic 1 to the ack1 bit in the interrupt status and control register (iscr). the ack1 bit is useful in applications that poll the irq1 pin and require software to clear the irq1 latch. writing to the ack1 bit can also prevent spurious interrupts due to noise. setting ack1 does not affect subsequent transitions on the irq1 pin. a falling edge that occurs after writing to the ack1 bit latches another interrupt request. if the irq1 mask bit, imask1, is clear, the cpu loads the program counter with the vector address at locations $fffa and $fffb. ? return of the irq1 pin to logic 1 as long as the irq1 pin is at logic 0, the irq1 latch remains set. the vector fetch or software clear and the return of the irq1 pin to logic 1 may occur in any order. the interrupt request remains pending as long as the irq1 pin is at logic 0. if the mode1 bit is clear, the irq1 pin is falling-edge-sensitive only. with mode1 clear, a vector fetch or software clear immediately clears the irq1 latch. use the bih or bil instruction to read the logic level on the irq1 pin. note: when using the level-sensitive interrupt trigger, avoid false interrupts by masking interrupt requests in the interrupt routine.
non-disclosure agreement required external interrupt module (irq) advance information mc68hc(9)08pt48 rev. 2.0 320 external interrupt module (irq) motorola 20.4.2 irq2 pin a logic 0 on the irq2 pin can latch an interrupt request into the irq2 interrupt latch. a vector fetch, software clear, or reset clears the irq2 interrupt latch. if the mode2 bit is set, the irq2 pin is both falling-edge-sensitive and low-level-sensitive. with mode2 set, both of these actions must occur to clear the irq2 interrupt latch: ? vector fetch, software clear, or reset a vector fetch generates an interrupt acknowledge signal to clear the latch. software may generate the interrupt acknowledge signal by writing a logic 1 to the ack2 bit in the interrupt status and control register (iscr). the ack2 bit is useful in applications that poll the irq2 pin and require software to clear the irq2 interrupt latch. writing to the ack2 bit can also prevent spurious interrupts due to noise. setting ack2 does not affect subsequent transitions on the irq2 pin. a falling edge that occurs after writing to the ack2 bit latches another interrupt request. if the irq2 mask bit, imask2, is clear, the cpu loads the program counter with the vector address at locations $fff8 and $fff9. ? return of the irq2 pin to logic 1 as long as the irq2 pin is at logic 0, the irq2 interrupt latch remains set. the vector fetch or software clear and the return of the irq2 pin to logic 1 may occur in any order. the interrupt request remains pending as long as the irq2 pin is at logic 0. if the mode2 bit is clear, the irq2 pin is falling-edge-sensitive only. with mode2 clear, a vector fetch or software clear immediately clears the irq2 interrupt latch. note: when using the level-sensitive interrupt trigger, avoid false interrupts by masking interrupt requests in the interrupt routine.
external interrupt module (irq) irq module during break interrupts mc68hc(9)08pt48 rev. 2.0 advance information motorola external interrupt module (irq) 321 non-disclosure agreement required 20.5 irq module during break interrupts the system integration module (sim) controls whether the irq1 and irq2 interrupt latches can be cleared during the break state. the bcfe bit in the sim break flag control register (sbfcr) enables software to clear the latches during the break state. (see 7.8.3 sim break flag control register .) to allow software to clear the irq1 latch and the irq2 interrupt latch during a break interrupt, write a logic 1 to the bcfe bit. if a latch is cleared during the break state, it remains cleared when the mcu exits the break state. to protect the latches during the break state, write a logic 0 to the bcfe bit. with bcfe at logic 0 (its default state), writing to the ack1 and ack2 bits in the irq status and control register during the break state has no effect on the irq latches. (see 20.6 irq status and control register .) 20.6 irq status and control register the irq status and control register (iscr) controls and monitors operation of the irq module. iscr has these functions: ? shows current state of the irq1 and irq2 interrupt flags ? clears the irq1 and irq2 interrupt latches ? masks irq1 and irq2 interrupt requests ? controls triggering sensitivity of the irq1 and irq2 interrupt pins
non-disclosure agreement required external interrupt module (irq) advance information mc68hc(9)08pt48 rev. 2.0 322 external interrupt module (irq) motorola irq2f irq2 flag bit this read-only bit is high when an irq2 cpu interrupt is pending. 1 = irq2 pin interrupt pending 0 = irq2 pin interrupt not pending ack2 irq2 interrupt request acknowledge bit writing a logic 1 to this write-only bit clears the irq2 interrupt latch. ack2 always reads as logic 0. reset clears ack2. imask2 irq2 interrupt mask bit writing a logic 1 to this read/write bit prevents the output of the irq2 interrupt latch from generating interrupt requests. reset clears imask2. 1 = irq2 pin interrupt request disabled 0 = irq2 pin interrupt request enabled mode2 irq2 interrupt edge/level select bit this read/write bit controls the triggering sensitivity of the irq2 interrupt pin. reset clears mode2. 1 = irq2 interrupt request on falling edges and low levels 0 = irq2 interrupt request on falling edges only irq1f irq1 flag bit this read-only bit is high when an irq1 cpu interrupt is pending. 1 = irq1 pin interrupt pending 0 = irq1 pin interrupt not pending address: $001d bit 7 654321 bit 0 read: irqf2 0 imask2 mode2 irqf1 0 imask1 mode1 write: ack2 ack1 reset: 00000000 = unimplemented figure 20-3. irq status and control register (iscr)
external interrupt module (irq) irq status and control register mc68hc(9)08pt48 rev. 2.0 advance information motorola external interrupt module (irq) 323 non-disclosure agreement required ack1 irq1 interrupt request acknowledge bit writing a logic 1 to this write-only bit clears the irq1 latch. ack1 always reads as logic 0. reset clears ack1. imask1 irq1 interrupt mask bit writing a logic 1 to this read/write bit disables irq1 interrupt requests. reset clears imask1. 1 = irq1 interrupt requests disabled 0 = irq1 interrupt requests enabled mode1 irq1 edge/level select bit this read/write bit controls the triggering sensitivity of the irq1 pin. reset clears mode1. 1 = irq1 interrupt request on falling edges and low levels 0 = irq1 interrupt request on falling edges only
non-disclosure agreement required external interrupt module (irq) advance information mc68hc(9)08pt48 rev. 2.0 324 external interrupt module (irq) motorola
mc68hc(9)08pt48 rev. 2.0 advance information motorola alert output generator (alr) 325 non-disclosure agreement required advance information mc68hc(9)08pt48 section 21. alert output generator (alr) 21.1 contents 21.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 21.3 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 21.4 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 21.4.1 alert control register . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 21.4.2 sound pressure level circuit . . . . . . . . . . . . . . . . . . . . . .328 21.4.3 alert data register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329 21.2 introduction this section describes the alert output generator (alr), which provides 14 software selectable square-wave output frequencies. 21.3 features features of the alr module include: ? 14 software selectable audio alert tone outputs ? 4-bit software-selectable, sound pressure level control
non-disclosure agreement required alert output generator (alr) advance information mc68hc(9)08pt48 rev. 2.0 326 alert output generator (alr) motorola 21.4 functional description this system will be used to generate alert tones as the output signal alert. the audio alert tone generator is controlled by the four control bits shown in 21.4.1 alert control register . this allows 14 possible frequencies to drive the alert output. the zero state acts as an off mode and places the output in a high-impedance mode and an on mode places the output in ground state. (see table 21-1 .). note: the alert module is enabled only when the on-chip phase-locked loop (pll) is engaged. during wait mode, the alert control register (alcr) register should be programmed with value $00 to ensure a three-state output and eliminate any residual output from the audio frequency generator. table 21-1. audio alert tone generator divider ratios al3Cal0 audio alert generator frequencies at given f osc f osc 32.768 khz 32.000 khz 38.4 khz 0000 off hi-z hi-z hi-z 0001 f osc ? 32 1024 1000 1200 0010 f osc ? 8 4096 4000 4800 0011 f osc ? 16 2048 2000 2400 0100 f osc ? 6 5461 5333 6400 0101 f osc ? 12 2730 2666 3200 0110 f osc ? 24 1365 1333 1600 0111 f osc ? 48 683 667 800 1000 f osc ? 10 3276 3200 3840 1001 f osc ? 20 1638 1600 1920 1010 f osc ? 40 819 800 960 1011 f osc ? 80 410 400 480 1100 f osc ? 14 2341 2285 2743 1101 f osc ? 28 1170 1143 1371 1110 f osc ? 56 585 571 686 1111 off v ss v ss v ss
alert output generator (alr) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola alert output generator (alr) 327 non-disclosure agreement required 21.4.1 alert control register the alert control register (alcr) bits are defined here. al3Cal0 alert frequency select the values of these bits determine the frequency of the alert output (see table 21-1 ). if these bits are set to all 0s, the alert output will be high impedance (off). if set to all 1s, the alert output will be at v ss (logic 0). reset clears these bits, turning this output off to the high-impedance state. address: $0036 bit 7 654321 bit 0 read: 0000 al3 al2 al1 al0 write: reset: 00000000 = unimplemented figure 21-1. alert control register (alcr)
non-disclosure agreement required alert output generator (alr) advance information mc68hc(9)08pt48 rev. 2.0 328 alert output generator (alr) motorola 21.4.2 sound pressure level circuit the sound pressure level (spl) control register is used to control the volume of the alert transducer. a high frequency clock signal is used to modulate the normal alert output frequency, this modulation reduces the amplitude of the frequency components in the audible range while adding new frequencies outside the audible range. this feature causes a significant reduction in the spl of the transducer. a broad range of volume control is obtained by altering the duty cycle of the high frequency modulation signal. the spl control register is software programmable to allow user to select different frequencies with different duty cycles. (see figure 21-2 .) figure 21-2. block diagram of spl reduction circuit divider ? 1 ? 2 ? 4 ? 8 m u x m u x internal cgmxclk fmodhi dcmod splclk duty cycle modulator audio signal frequency selection v cc v o spl6 bus clock
alert output generator (alr) functional description mc68hc(9)08pt48 rev. 2.0 advance information motorola alert output generator (alr) 329 non-disclosure agreement required 21.4.3 alert data register the alert data register (aldr) bits are defined here. spl7 this bit selects between 16-phase duty cycle modulation if bit spl7 = 0 and 8-phase duty cycle modulation if bit spl7 = 1. spl6 this bit selects between the output (dcmod) of the duty cycle modulator when spl6 = 0 and the clock fmodhi when spl6 = 1 to send to the output splclk to modulate the alert output. (refer to figure 21-2 .) spl5 and spl4 these bits are used to control the frequency divider selections (divided by 1, 2, and 4), and, along with bit spl6 in one case where both spl4 and spl5 are high, to select between a cpu clock divided by eight and the crystal clock. (see table 21-2 .) address: $0037 bit 7 654321 bit 0 read: spl7 spl6 spl5 spl4 spl3 spl2 spl1 spl0 write: reset: 00000000 figure 21-3. alert data register (aldr) table 21-2. clock divider and modulator selections spl6 spl5 spl4 fmodhi splclk 0 0 0 bus clock/1 dcmod 0 0 1 bus clock/2 dcmod 0 1 0 bus clock/4 dcmod 0 1 1 bus clock/8 dcmod 1 0 0 bus clock/1 fmodhi
non-disclosure agreement required alert output generator (alr) advance information mc68hc(9)08pt48 rev. 2.0 330 alert output generator (alr) motorola spl3Cspl0 these bits control the duty cycle of the modulation signal, as shown in table 21-3 . 1 0 1 bus clock/2 fmodhi 1 1 0 bus clock/4 fmodhi 1 1 1 cgmxclk fmodhi table 21-3. duty cycle selection spl3 spl2 spl1 spl0 duty cycle 8-phase count (spl7 = 1) duty cycle 16-phase count (spl7 = 0) 0 0 0 0 spl disabled spl disabled 0 0 0 1 1/8 high 7/8 low 1/16 high 15/16 low 0 0 1 0 2/8 high 6/8 low 2/16 high 14/16 low 0 0 1 1 3/8 high 5/8 low 3/16 high 13/16 low 0 1 0 0 4/8 high 4/8 low 4/16 high 12/16 low 0 1 0 1 5/8 high 3/8 low 5/16 high 11/16 low 0 1 1 0 6/8 high 2/8 low 6/16 high 10/16 low 0 1 1 1 7/8 high 1/8 low 7/16 high 9/16 low 1 0 0 0 spi disabled 8/16 high 8/16 low 1 0 0 1 1/8 high 7/8 low 9/16 high 7/16 low 1 0 1 0 2/8 high 6/8 low 10/16 high 6/16 low 1 0 1 1 3/8 high 5/8 low 11/16 high 5/16 low 1 1 0 0 4/8 high 4/8 low 12/16 high 4/16 low 1 1 0 1 5/8 high 3/8 low 13/16 high 3/16 low 1 1 1 0 6/8 high 2/8 low 14/16 high 2/16 low 1 1 1 1 7/8 high 1/8 low 15/16 high 1/16 low table 21-2. clock divider and modulator selections (continued) spl6 spl5 spl4 fmodhi splclk
mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 331 non-disclosure agreement required advance information mc68hc(9)08pt48 section 22. electrical specifications 22.1 contents 22.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331 22.3 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . .332 22.4 functional operating range. . . . . . . . . . . . . . . . . . . . . . . . . .333 22.5 thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .333 22.6 3.0-volt dc electrical characteristics. . . . . . . . . . . . . . . . . . .334 22.7 2.0-volt dc electrical characteristics. . . . . . . . . . . . . . . . . . .335 22.8 ram retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 22.9 3.0-volt control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 22.10 2.0-volt control timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 22.11 3.0-volt spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . .337 22.12 2.0-volt spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . .338 22.13 pll2p12m electrical specifications . . . . . . . . . . . . . . . . . . . .341 22.14 pll2p12m component specifications . . . . . . . . . . . . . . . . . .341 22.15 bus clock pll acquisition/lock time specifications . . . . . . .342 22.16 2-k flash memory electrical characteristics . . . . . . . . . . . .343 22.17 48-k flash memory electrical characteristics . . . . . . . . . . .343 22.18 adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344 22.2 introduction this section contains electrical and timing specifications.
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 332 electrical specifications motorola 22.3 absolute maximum ratings maximum ratings are the extreme limits to which the mcu can be exposed without permanently damaging it. the mcu contains circuitry to protect the inputs against damage from high static voltages; however, do not apply voltages higher than those shown in this table. keep v in and v out within the range v ss (v in or v out ) v dd . connect unused inputs to the appropriate voltage level, either v ss or v dd . note: this device is not guaranteed to operate properly at the maximum ratings. refer to 22.6 3.0-volt dc electrical characteristics and 22.7 2.0-volt dc electrical characteristics for guaranteed operating conditions. rating symbol value unit supply voltage v dd C0.3 to +3.6 v input voltage v in v ss C0.3 to v dd +0.3 v maximum current per pin excluding v dd and v ss i 25 ma storage temperature t stg C55 to +150 c maximum current out of v ss i mvss 100 ma maximum current into v dd i mvdd 100 ma note: voltages are referenced to v ss .
electrical specifications functional operating range mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 333 non-disclosure agreement required 22.4 functional operating range 22.5 thermal characteristics rating symbol value unit operating temperature range t a C20 to +65 c operating voltage range (1) 1. lcd charge pump optimized for given ranges v dd 2.0 10% 3.0 10% v note: characteristic symbol value unit thermal resistance, 80 pin lqfp q ja 57 c/w i/o pin power dissipation p i/o user determined w power dissipation (1) 1. power dissipation is a function of temperature p d p d = (i dd x v dd ) + p i/o = k/(t j + 273 c) w constant (2) 2. k is a constant unique to the device. k can be determined from a known t a and measured p d . with this value of k, p d and t j can be determined for any value of t a . k p d x (t a + 273 c) + (p d 2 x q ja ) w/ c average junction temperature t j t a = p d q ja c maximum junction temperature t jm 100 c note:
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 334 electrical specifications motorola 22.6 3.0-volt dc electrical characteristics characteristic (1) 1. v dd = 3.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted. symbol min typ (2) 2. typical values reflect average measurements at midpoint of voltage range, 25 c only. max unit output high voltage (i load = C0.4 ma) all ports v oh 0.7 x v dd v output low voltage (i load = 0.8 ma) all ports v ol 0.3 x v dd v input high voltage all ports, irqs, reset, osc1 v ih 0.7 x v dd v dd v input low voltage all ports, irqs, reset, osc1 v il v ss 0.3 x v dd v v dd supply current run (3) wait (4) stop (5) 3. run (operating) i dd measured using external square wave clock source (f op = 4.0 mhz). measurements represent total current drain on ev dd /v dd /v dda power supply pins. ev dd =v dd =v dda . all inputs at 0.2 v from rail. no dc loads. less than 100 pf on all outputs. c l = 20 pf on osc2. all ports configured as inputs. osc2 capacitance linearly affects run i dd . measured with cgm (pll off) disabled. 4. wait i dd measured using external square wave clock source (f op = 4.0 mhz). measurements represent total current drain on ev dd /v dd /v dda power supply pins. ev dd =v dd =v dda . all inputs 0.2 v from rail. no dc loads. less than 100 pf on all outputs. c l = 20 pf on osc2. all ports configured as inputs. osc2 capacitance linearly affects wait i dd . measured with cgm (pll off) module disabled. 5. stop i dd measured with osc1 = v ss . i dd 4 2 10 ma ma m a i/o ports hi-z leakage current i il 10 m a input current i in 1 m a capacitance ports (as input or output) c out c in 12 8 pf por re-arm voltage (6) 6. maximum is highest voltage that por is guaranteed. v por 0 200 mv por reset voltage (7) 7. maximum is highest voltage that por is possible. v porrst 0 700 800 mv por rise time ramp rate (8) 8. if minimum v dd is not reached before the internal por reset is released, rst must be driven low externally until minimum v dd is reached. r por 0.02 v/ms notes:
electrical specifications 2.0-volt dc electrical characteristics mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 335 non-disclosure agreement required 22.7 2.0-volt dc electrical characteristics characteristic (1) 1. v dd = 2.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted. symbol min typ (2) 2. typical values reflect average measurements at midpoint of voltage range, 25 c only. max unit output high voltage (i load = -0.4 ma) all ports v oh 0.7 x v dd v output low voltage (i load = 0.8 ma) all ports v ol 0.3 x v dd v input high voltage all ports, irqs, reset, osc1 v ih 0.7 x v dd v dd v input low voltage all ports, irqs, reset, osc1 v il v ss 0.3 x v dd v v dd supply current run (3) wait (4) stop (5) 3. run (operating) i dd measured using external square wave clock source (f op = 2.0 mhz). measurements represent total current drain on ev dd /v dd /v dda power supply pins. ev dd =v dd =v dda . all inputs at 0.2 v from rail. no dc loads. less than 100 pf on all outputs. c l = 20 pf on osc2. all ports configured as inputs. osc2 capacitance linearly affects run i dd . measured with cgm (pll off) disabled. 4. wait i dd measured using external square wave clock source (f op = 2.0 mhz). measurements represent total current drain on ev dd /v dd /v dda power supply pins. ev dd =v dd =v dda . all inputs 0.2 v from rail. no dc loads. less than 100 pf on all outputs. c l = 20 pf on osc2. all ports configured as inputs. osc2 capacitance linearly affects wait i dd . measured with cgm (pll off) module disabled. 5. stop i dd measured with osc1 = v ss . i dd 2 1 8 ma ma m a i/o ports hi-z leakage current i il 10 m a input current i in 1 m a capacitance ports (as input or output) c out c in 12 8 pf por re-arm voltage (6) 6. maximum is highest voltage that por is guaranteed. v por 0 200 mv por reset voltage (7) 7. maximum is highest voltage that por is possible. v porrst 0 700 800 mv por rise time ramp rate (8) 8. if minimum v dd is not reached before the internal por reset is released, rst must be driven low externally until minimum v dd is reached. r por 0.02 v/ms notes:
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 336 electrical specifications motorola 22.8 ram retention 22.9 3.0-volt control timing 22.10 2.0-volt control timing characteristic symbol min typ max unit ram data retention voltage v rdr 0.7 v characteristic (1) 1. v ss = 0 vdc; timing shown with respect to 20% v dd and 70% v dd unless noted symbol min max unit frequency of operation crystal option (2) 2. see 22.14 pll2p12m component specifications for more information f osc 32 100 khz internal operating frequency f op 4.0 mhz reset input pulse width low (3) 3. minimum pulse width reset is guaranteed to be recognized; it is possible for a smaller pulse width to cause a reset. t irl 125 ns irq interrupt pulse width low (4) (edge-triggered) 4. minimum pulse width is for guaranteed interrupt; it is possible for a smaller pulse width to be recognized t ilih 125 ns notes: characteristic (1) 1. v ss = 0 vdc; timing shown with respect to 20% v dd and 70% v dd unless noted symbol min max unit frequency of operation crystal option (2) 2. see 22.14 pll2p12m component specifications for more information f osc 32 100 khz internal operating frequency f op 2.0 mhz reset input pulse width low (3) 3. minimum pulse width reset is guaranteed to be recognized; it is possible for a smaller pulse width to cause a reset. t irl 125 ns irq interrupt pulse width low (4) (edge-triggered) 4. minimum pulse width is for guaranteed interrupt; it is possible for a smaller pulse width to be recognized. t ilih 125 ns notes:
electrical specifications 3.0-volt spi characteristics mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 337 non-disclosure agreement required 22.11 3.0-volt spi characteristics diagram number (1) 1. numbers refer to dimensions in figure 22-1 and figure 22-2 . characteristic (2) 2. all timing is shown with respect to 20% v dd and 70% v dd , unless noted; assumes 100 pf load on all spi pins. symbol min max unit operating frequency master slave f op(m) f op(s) f op /128 dc f op /2 f op mhz 1 cycle time master slave t cyc(m) t cyc(s) 2 1 128 t cyc 2 enable lead time t lead(s) 30 ns 3 enable lag time t lag(s) 30 ns 4 clock (sck) high time master slave t sckh(m) t sckh(s) 200 100 ns 5 clock (sck) low time master slave t sckl(m) t sckl(s) 200 100 ns 6 data setup time (inputs) master slave t su(m) t su(s) 90 10 ns 7 data hold time (inputs) master slave t h(m) t h(s) 0 30 ns 8 access time, slave (3) cpha = 0 chpa = 1 3. time to data active from high-impedance state t a(cp0) t a(cp1) 0 0 80 40 ns 9 disable time, slave (4) 4. hold time to high-impedance state t dis(s) 50ns 10 data valid time (after enable edge) master slave (5) 5. with 100 pf on all spi pins t v(m) t v(s) 20 80 ns 11 data hold time (outputs, after enable edge) master slave t ho(m) t ho(s) 0 10 ns notes:
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 338 electrical specifications motorola 22.12 2.0-volt spi characteristics diagram number (1) 1. numbers refer to dimensions in figure 22-1 and figure 22-2 . characteristic (2) 2. all timing is shown with respect to 20% v dd and 70% v dd , unless noted; assumes 100 pf load on all spi pins symbol min max unit operating frequency master slave f op(m) f op(s) f op /128 dc f op /2 f op mhz 1 cycle time master slave t cyc(m) t cyc(s) 2 1 128 t cyc 2 enable lead time t lead(s) 60 ns 3 enable lag time t lag(s) 60 ns 4 clock (sck) high time master slave t sckh(m) t sckh(s) 400 200 ns 5 clock (sck) low time master slave t sckl(m) t sckl(s) 400 200 ns 6 data setup time (inputs) master slave t su(m) t su(s) 180 20 ns 7 data hold time (inputs) master slave t h(m) t h(s) 0 60 ns 8 access time, slave (3) cpha = 0 chpa = 1 3. time to data active from high-impedance state. t a(cp0) t a(cp1) 0 0 160 80 ns 9 disable time, slave (4) 4. hold time to high-impedance state. t dis(s) 100 ns 10 data valid time (after enable edge) master slave (5) 5. with 100 pf on all spi pins. t v(m) t v(s) 40 160 ns 11 data hold time (outputs, after enable edge) master slave t ho(m) t ho(s) 0 2 ns notes:
electrical specifications 2.0-volt spi characteristics mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 339 non-disclosure agreement required figure 22-1. spi master timing note note: this first clock edge is generated internally, but is not seen at the sck pin. ss pin of master held high. msb in ss input sck (cpol = 0) output sck (cpol = 1) output miso input mosi output note 4 5 5 1 4 bits 6C1 lsb in master msb out bits 6C1 master lsb out 10 11 10 11 7 6 note note: this last clock edge is generated internally, but is not seen at the sck pin. ss pin of master held high. msb in ss input sck (cpol = 0) output sck (cpol = 1) output miso input mosi output note 4 5 5 1 4 bits 6C1 lsb in master msb out bits 6C1 master lsb out 10 11 10 11 7 6 a) spi master timing (cpha = 0) b) spi master timing (cpha = 1)
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 340 electrical specifications motorola figure 22-2. spi slave timing note: not defined but normally msb of character just received slave ss input sck (cpol = 0) input sck (cpol = 1) input miso input mosi output 4 5 5 1 4 msb in bits 6C1 8 6 10 11 11 note slave lsb out 9 3 lsb in 2 7 bits 6C1 msb out note: not defined but normally lsb of character previously transmitted slave ss input sck (cpol = 0) input sck (cpol = 1) input miso output mosi input 4 5 5 1 4 msb in bits 6C1 8 6 10 note slave lsb out 9 3 lsb in 2 7 bits 6C1 msb out 10 a) spi slave timing (cpha = 0) b) spi slave timing (cpha = 1) 11 11
electrical specifications pll2p12m electrical specifications mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 341 non-disclosure agreement required 22.13 pll2p12m electrical specifications 22.14 pll2p12m component specifications description symbol min typ max notes cgmxclk reference frequency (hz) f rclk 38.4 k range nominal multiplier (hz) f nom 38.4 k vco center-of-range frequency (hz) f vrs 38.4 k 38.4 k 20.0 m 10.0 m 2.7C3.3 v, v dd only 1.8C2.7 v, v dd only vco range linear range multiplier l 1 64 255 vco power-of-two range multiplier 2 e 11 8 vco multiply factor n 1 64 4095 vco prescale multiplier 2 p 11 8 reference divider factor r 1 1 15 vco operating frequency f vclk f vrsmin f vrsmax bus operating frequency (hz) f bus 4 m 2 m 2.7C3.3 v, v dd only 1.8C2.7 v, v dd only characteristic symbol min typ max notes crystal load capacitance c l consult crystal manufacturers data crystal ?xed capacitance c 1 2*c l consult crystal manufacturers data crystal tuning capacitance c 2 2*c l consult crystal manufacturers data feedback bias resistor r b 22 m w series resistor r s 0 330 k w 1m w not required filter capacitor c f c fact * (v dda /f xclk ) bypass capacitor c byp 0.1 m f c byp must provide low ac impedance from f = f xclk /100 to 100*f vclk , so series resistance must be considered.
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 342 electrical specifications motorola 22.15 bus clock pll acquisition/lock time specifications specifications for the entry and exit of acquisition and tracking modes, as well as required manual mode delay times are provided here. description symbol min typ max notes filter capacitor multiply factor c fact 0.0145 f/sv acquisition mode time factor k acq 0.117 v tracking mode time factor k trk 0.021 v manual mode time to stable t acq 10 ms c f = 0.1 m f (1) manual stable to lock time t al 20 ms c f = 0.1 m f (1) manual acquisition time t lock t acq + t al tracking mode entry frequency tolerance d trk 0 3.6% acquisition mode entry frequency tolerance d acq 6.3% 7.2% lock entry frequency tolerance d lock 0 0.9% lock exit frequency tolerance d unl 0.9% 1.8% reference cycles per acquisition mode measurement n acq 32 reference cycles per tracking mode measurement n trk 128 automatic mode time to stable t acq 10 ms c f = 0.1 m f (1) automatic stable to lock time t al 15 ms c f = 0.1 m f (1) automatic lock time t lock t acq + t al note: 1. refer to 22.14 pll2p12m component specifications for information on calculating c f .
electrical specifications 2-k flash memory electrical characteristics mc68hc(9)08pt48 rev. 2.0 advance information motorola electrical specifications 343 non-disclosure agreement required 22.16 2-k flash memory electrical characteristics 22.17 48-k flash memory electrical characteristics parameter description min recommended max units t erase erase time 100 110 ms t k ill high voltage kill time 200 200 m s t hvd return to read mode time 50 50 m s t step (1) 1. t step is defined as the amount of time during a program cycle in which the hven bit is set. program step size 0.8 1.0 1.2 ms pulses number of program pulses/page 1 5 ms endurance (2) 2. minimum endurance means the part is guaranteed to work up to this many erase/program cycles. erase/program cycles 10,000 cycles f cp2 charge pump clock frequency for 2-k flash 1.0 2.0 2.5 mhz t hvtv hven low to verf high time 50 m s t vtp verf high to pgm low time 150 m s notes: parameter description min recommended max units t erase erase time 100 110 ms t k ill high voltage kill time 200 200 m s t hvd return to read mode time 50 50 m s t step (1) 1. t step is defined as the amount of time during a program cycle in which the hven bit is set. program step size 0.8 1.0 1.2 ms pulses number of program pulses/page 1 5 ms endurance (2) 2. minimum endurance means the part is guaranteed to work up to this many erase/program cycles. erase/program cycles 100 cycles f cp2 charge pump clock frequency for 48-k flash 1.8 2.0 2.5 mhz t hvtv hven low to verf high time 50 m s t vtp verf high to pgm low time 150 m s notes:
non-disclosure agreement required electrical speci?cations advance information mc68hc(9)08pt48 rev. 2.0 344 electrical specifications motorola 22.18 adc characteristics characteristic symbol min typ max notes supply voltage v dda2 1.8 3.3 v v dda2 should be tied to the same potential as v dd via separate traces. input voltages v adin v refh 0 1.5 v refh v dda2 v resolution b ad 7 7 bits adc internal clock f adic 500 k 1.048 m hz t aic = 1/f adic conversion range r ad v ssa2 v refh v power-up time t adpu 16 t aic cycles conversion time t adc 16 17 t aic cycles sample time t ads 5 t aic cycles monotocity m ad guaranteed zero input reading z adi 00 hex v in = v ssa2 full-scale reading f adi ff hex v in = v refh input capacitance c adi 20 pf not tested
mc68hc(9)08pt48 rev. 2.0 general release specification motorola mechanical data 345 non-disclosure agreement required general release specification mc68hc(9)08pt48 section 23. mechanical data 23.1 contents 23.2 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 23.3 80-pin lqfp (case 917-01) . . . . . . . . . . . . . . . . . . . . . . . . . .346 23.2 introduction this section describes the dimensions of the 80-pin quad flat pack (lqfp). 23.3 80-pin lqfp (case 917-01) shows the latest package at the time of this publication. to make sure that you have the latest package specifications, contact one of the following: ? local motorola sales office ? motorola fax back system (mfax?) C phone 1-602-244-6609 C email rmfax0@email.sps.mot.com; http://sps.motorola.com/mfax/ ? worldwide web (wwweb) home page at http://www.mot- sps.com/cgi-bin-cases follow mfax or wwweb on-line instructions to retrieve the current mechanical specifications.
non-disclosure agreement required mechanical data general release specification mc68hc(9)08pt48 rev. 2.0 346 mechanical data motorola 23.3 80-pin lqfp (case 917-01) r (r2) 4x view y 61 60 40 41 21 80 20 1 a2 a view p b b c1 c b b1 ???? ? ?? ? ???? r (r1) s (l2)  view p 4x ab 0.200 c d pin 1 idex 0.1 8x a1  76x seating plane view y 3 places section bb 80 places  1 rotated 90 clockwise plating base metal  d d/2 d1 d1/2 e b e/2 e1 e1/2 a d ab 0.200 h d e 2 h c c l (l1) 0.25 gage plane e/2 x notes: 1. all dimensions and tolerances to conform to asme y14.5m, 1994. 2. controlling dimension: millimeter. 3. datum plane h is coincident with the bottom of the lead where the lead exits the plastic body at the bottom of the parting line. 4. datums a, b and d to be determined at datum plane h. 5. dimensions d and e to be determined at seating plane datum c. 6. dimensions a and b do not include mold protrusion. allowable protrusion is 0.25 per side. dimensions a and b do include mold mismatch and are determined at datum plane h. 7. dimension d does not include dambar protrusion. the dambar protrusion shall not cause the d dimension to exceed 0.35. dim min max millimeters a 1.60 a1 0.05 0.15 a2 1.35 1.45 d 14.000 bsc d1 12.00 bsc e 14.000 bsc e1 12.00 bsc l 0.45 0.75 l1 1.00 ref l2 0.50 ref r1 0.20 ref r2 0.20 ref s 0.17 ref b 0.17 0.27 b1 0.17 0.23 c 0.12 0.20 c1 0.12 0.16 e 0.50 bsc 0 7 1 0 2 10 14       x=a, b, or d ab 0.08 cd m
mc68hc(9)08pt48 rev. 2.0 advance information motorola ordering information 347 non-disclosure agreement required advance information mc68hc(9)08pt48 section 24. ordering information 24.1 contents 24.2 mcu ordering forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347 24.3 application program media. . . . . . . . . . . . . . . . . . . . . . . . . . .348 24.4 rom program verification . . . . . . . . . . . . . . . . . . . . . . . . . . .349 24.5 rom verification units (rvus). . . . . . . . . . . . . . . . . . . . . . . .350 24.6 mc order numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .350 24.2 mcu ordering forms to initiate an order for a rom-based mcu, first obtain the current ordering form for the mcu from a motorola representative. submit the following items when ordering mcus: ? a current mcu ordering form that is completely filled out (contact your motorola sales office for assistance.) ? a copy of the customer specification if it deviates from the motorola specification for the mcu ? customers application program on one of the media listed in 24.3 application program media the current mcu ordering form is also available through the motorola freeware bulletin board service (bbs). the telephone number is (512) 891-free. after making the connection, type bbs in lowercase letters. then press the return key to start the bbs software.
non-disclosure agreement required ordering information advance information mc68hc(9)08pt48 rev. 2.0 348 ordering information motorola 24.3 application program media deliver the application program to motorola in one of these media: ? macintosh ?1 3-1/2-inch diskette (double-sided 800 k or double-sided high-density 1.4 m) ? ms-dos ?2 or pc-dos tm 3 3 1/2-inch diskette (double-sided 720 k or double-sided high-density 1.44 m) ? ms-dos ? or pc-dos 5 1/4-inch diskette (double-sided double-density 360 k or double-sided high-density 1.2 m) use positive logic for data and addresses. when submitting the application program on a diskette, clearly label the diskette with the following information: ? customer name ? customer part number ? project or product name ? file name of object code ? date ? name of operating system that formatted diskette ? formatted capacity of diskette on diskettes, the application program must be in motorolas s-record format (s1 and s9 records), a character-based object file format generated by m6805 cross assemblers and linkers. begin the application program at the first user rom location. program addresses must correspond exactly to the available on-chip user rom addresses as shown in the memory map. write $00 in all non-user rom locations or leave all non-user rom locations blank . refer to the current mcu ordering form for additional requirements. motorola may request pattern resubmission if non-user areas contain any non- zero code. 1. macintosh is a registered trademark of apple computer, inc. 2. ms-dos is a registered trademark of microsoft corporation. 3. pc-dos is a trademark of international business machines corporation.
ordering information rom program verification mc68hc(9)08pt48 rev. 2.0 advance information motorola ordering information 349 non-disclosure agreement required if the memory map has two user rom areas with the same addresses, then write the two areas in separate files on the diskette. label the diskette with both filenames. in addition to the object code, a file containing the source code can be included. motorola keeps this code confidential and uses it only to expedite rom pattern generation in case of any difficulty with the object code. label the diskette with the filename of the source code. 24.4 rom program verification the primary use for the on-chip rom is to hold the customers application program. the customer develops and debugs the application program and then submits the mcu order along with the application program. motorola enters the customers application program code into a computer program that generates a listing verify file. the listing verify file represents the memory map of the mcu. the listing verify file contains the user rom code and may also contain non-user rom code, such as selfcheck code. motorola sends the customer a computer printout of the listing verify file along with a listing verify form. to aid the customer in checking the listing verify file, motorola programs the listing verify file into customer-supplied, blank, preformatted macintosh or dos disks. all original pattern media are filed for contractual purposes and are not returned. check the listing verify file thoroughly, then complete and sign the listing verify form and return the listing verify form to motorola. the signed listing verify form constitutes the contractual agreement for the creation of the custom mask.
non-disclosure agreement required ordering information advance information mc68hc(9)08pt48 rev. 2.0 350 ordering information motorola 24.5 rom verification units (rvus) after receiving the signed listing verify form, motorola manufactures a custom photographic mask. the mask contains the customers application program and is used to process silicon wafers. the application program cannot be changed after the manufacture of the mask begins. motorola then produces 10 mcus, called rvus, and sends the rvus to the customer. rvus are usually packaged in unmarked ceramic and tested to 5 vdc at room temperature. rvus are not tested to environmental extremes because their sole purpose is to demonstrate that the customers user rom pattern was properly implemented. the 10 rvus are free of charge with the minimum order quantity. these units are not to be used for qualification or production. rvus are not guaranteed by motorola quality assurance. 24.6 mc order numbers table 24-1. mc order numbers mc order number operating temperature range mc68hc(9)08pt48cfu (1) 1. fu = plastic quad flat pack package C40 c to + 85 c

mc68hc08pt48/d motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee r egarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and speci? cally disclaims any and all liability, including without limitation consequential or incidental damages. "typical" parameters which may be provided in motorola data sheets and/or speci ?cations can and do vary in different applications and actual performance may vary over time. all operating parameters, including "typicals" must be validated for each customer applica tion by customer's technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failu re of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized applicati on, buyer shall indemnify and hold motorola and its of?cers, employees, subsidiaries, af?liates, and distributors harmless against all claims, costs, damages, and expenses, and rea sonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that mot orola was negligent regarding the design or manufacture of the part. motorola and are registered trademarks of motorola, inc. motorola, inc. is an equal opportuni ty/af?rmative action employer. how to reach us: usa/europe/locations not listed: motorola literature distribution, p.o. box 5405, denver, colorado 80217, 1-800-441-2447 or 1-303-675-2140. customer focus center, 1-800-521-6274 japan: motorola japan ltd.: spd, strategic planning of?ce, 141, 4-32-1 nishi-gotanda, shinagawa-ku, tokyo, japan. 03-5487-8488 asia/pacific: motorola semiconductors h.k. ltd., 8b tai ping industrial park, 51 ting kok road, tai po, n.t., hong kong. 852-26629298 mfax?, motorola fax back system: rmfax0@email.sps.mot.com; http://sps.motorola.com/mfax/; touchtone, 1-602-244-6609; us and canada only, 1-800-774-1848 home page: http://motorola.com/sps/ mfax is a trademark of motorola, inc. ? motorola, inc., 1998


▲Up To Search▲   

 
Price & Availability of MC68HC908PT48CFU

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X